awesome-phonenumber
awesome-phonenumber copied to clipboard
Usage in Deno seems not to be documented in README.md
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 :)
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'
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' } );