3.1.4 • Published 10 years ago
phone-input v3.1.4
phone-input 
US phone input component for virtual-dom
Parsing, formatting, and validation by phones
Install
$ npm install --save phone-inputUsage
var PhoneInput = require('phone-input')
var phoneInput = PhoneInput()
function render (state) {
var vtree = PhoneInput.render(state)
//=> use virtual-dom to patch vtree into real DOM
}
phoneInput(render)API
PhoneInput(data) -> function
Create a new phone input observable.
data
Type: object
The initial state of the input.
value
Type: string
The phone number, a string of digits with no punctuation.
PhoneInput.validate(state) -> boolean
Validate the current value.
PhoneInput.render(state, options) -> object
Render a phone state to a vtree object. options will be merged with the defaults ({type: 'tel', name: 'phone'}) and passed to virtual-hyperscript. Set options.separator to change the default of dash-separated number groups.
License
MIT © Ben Drucker