3.1.4 • Published 10 years ago

phone-input v3.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

phone-input Build Status

US phone input component for virtual-dom

Parsing, formatting, and validation by phones

Install

$ npm install --save phone-input

Usage

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

3.1.4

10 years ago

3.1.3

10 years ago

3.1.2

10 years ago

3.1.1

10 years ago

3.1.0

10 years ago

3.0.0

10 years ago

2.0.0

10 years ago

1.0.0

10 years ago