Socket
Socket
Sign inDemoInstall

libphonenumber-getexample

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    libphonenumber-getexample

A smaller realization of libphonenumber-js getExampleNumber function


Version published
Weekly downloads
4
Maintainers
1
Install size
207 kB
Created
Weekly downloads
 

Readme

Source

libphonenumber-getexample

npm

A smaller realization of Google libphonenumber getExampleNumber function:

  • Tiny footprint: ~15 kilobytes minified and ~5kb gzipped

Install

via npm

$ npm install libphonenumber-getexample

Use

es6 modules

import { getExampleNumber } from 'libphonenumber-getexample'

const phoneNumber = getExampleNumber('us') // || 'US'

phoneNumber.formatNational() === '(213) 373-4253'
phoneNumber.formatInternational() === '+1 213 373 4253'

browser

$(document).ready(function() {
    const { getExampleNumber } = window.libphonenumberGetexample

    // etc
})

Examples

ReactJS

import React from 'react'
import { getExampleNumber } from 'libphonenumber-getexample'

export class ExampleForm extends React.Component {
  state = {
    phonePlaceholder: getExampleNumber(this.props.userCountry).formatInternational()
  }

  render = () => (
    <form>
      <label>Phone number</label>
      <input type="text" palceholder={this.state.phonePlaceholder} />
    </form>
  )
}

License

MIT

Keywords

FAQs

Last updated on 23 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc