ember-libphonenumber-js

0.6.0 • Public • Published

ember-libphonenumber-js npm version Build Status Greenkeeper badge Ember Observer Score

This addon provides a way to add Google's libphonenumber to your ember project using libphonenumber-js from https://github.com/catamphetamine/libphonenumber-js. This version of libphonenumber is much lighter than Google's, coming in at 120 KB.

Additionally, this addon provides some template helper (format only at this time). Computed properties are coming soon.

Compatibility

  • Ember.js v2.18 or above
  • Ember CLI v2.13 or above

Installation

  • ember install ember-libphonenumber-js

Usage

import { parse, format } from 'libphonenumber-js'
 
parse('8 (800) 555 35 35', 'RU')
// { country: 'RU', phone: '8005553535' }
 
format('2133734253', 'US', 'International')
// '+1 213 373 4253'
 

For other uses, please visit https://github.com/catamphetamine/libphonenumber-js

Template Helper

The helper takes 2 parameters, a phone number and a 2 byte country code (ex: 'US'). Additionally, you can force international formatting by providing forceIntl=true.

{{format-phonenumber '6615551212' 'US'}} {{!-- (661) 555-1212 --}}

With forceIntl=true

{{format-phonenumber '6615551212' 'US' forceIntl=true}} {{!-- +1 661 555 1212 --}}

Package Sidebar

Install

npm i ember-libphonenumber-js

Weekly Downloads

5

Version

0.6.0

License

MIT

Unpacked Size

7.56 kB

Total Files

13

Last publish

Collaborators

  • tylerturdenpants