Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage in Deno seems not to be documented in README.md #54

Open
michael-spengler opened this issue Sep 12, 2020 · 2 comments
Open

Usage in Deno seems not to be documented in README.md #54

michael-spengler opened this issue Sep 12, 2020 · 2 comments

Comments

@michael-spengler
Copy link

Dear awesome phonenumber team.

I'd like to use this via deno style import.

I could not find anything related in your README.md. As you published it here: https://deno.land/x/[email protected] I guess somehow one can make this work in Deno.

Looking forward to some hints :)

@panigrah
Copy link

i dont think the typings are there for deno. This is what I ended up doing:

//file ./utils/phone.ts
import { createRequire } from "https://deno.land/std/node/module.ts";
const require = createRequire(import.meta.url)
const libphonenumber = require('awesome-phonenumber')
export const { parsePhoneNumber} = libphonenumber

and then install it
yarn add awesome-phonenumber

now where ever I need the phone number all I do is

import { parsePhoneNumber } from './utils/phone.ts'

@monobjorn
Copy link

I used it with Deno (and Supabase) by just importing from esm.sh:

import { parsePhoneNumber } from "https://esm.sh/[email protected]"

then I can just:
const pn = parsePhoneNumber( '0707123456', { regionCode: 'SE' } );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants