2.1.0 • Published 5 years ago
input-core v2.1.0
input-core
This project would help you if:
- You don't need to create an input for user, but only formatting to show data as a plain text
- You want to create your own compnent which will work with inputs
Step-by-step guide:
Install it
npm install --save input-coreor
yarn add input-coreimport it:
import { createInput } from 'input-core';Create an object (for example, if we want to format phone):
export default function formatPhone(value, mask) {
const input = createInput({
value,
mask,
});
return input.getVisibleValue();
}- Use it wherever you need ;)
const phone = '9651112222';
...
formatPhone(phone, '+7 (000) 000 00-00'); // returns +7 (965) 111 22-22License
MIT