JSPM

phone-regex

2.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2334
  • Score
    100M100P100Q127163F
  • License MIT

Regular expression for phone numbers.

Package Exports

  • phone-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (phone-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Phone Regex

Build Status

A regular expression for matching phone numbers.

Installation

npm i --save phone-regex

Usage

var phone = require('phone-regex');

// Exact string option
phone({ exact: true }).test('1234567890')       // => true
phone({ exact: true }).test('apple 1234567890') // => false

// Global option (default)
phone().test('1234567890')       // => true
phone().test('apple 1234567890') // => true
phone().test('apple')            // => false

// Indian option
phone({ indian: true }).test('mango 9744142626')              // => true
phone({ indian: true }).test('mango 1234567890')              // => false
phone({ indian: true, exact: true }).test('mango 9744142626') // => false

Acknowledgements

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander. Support for Indian Numbers added by Livin Mathew.