michangarrito/apps/backend/node_modules/libphonenumber-js/mobile/exports/PhoneNumber.js
rckrdmrd 97f407c661 [MIGRATION-V2] feat: Migrar michangarrito a estructura v2
- Prefijo v2: MCH
- TRACEABILITY-MASTER.yml creado
- Listo para integracion como submodulo

Workspace: v2.0.0 | SIMCO: v4.0.0
2026-01-10 11:28:54 -06:00

22 lines
1.1 KiB
JavaScript

// Importing from a ".js" file is a workaround for Node.js "ES Modules"
// importing system which is even uncapable of importing "*.json" files.
import metadata from '../../metadata.mobile.json.js'
import { PhoneNumber as _PhoneNumber } from '../../core/index.js'
export function PhoneNumber(number) {
return _PhoneNumber.call(this, number, metadata)
}
// Setting `PhoneNumber.prototype` via `Object.create()`
// didn't work with `instanceof` operator for some strange reason.
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/201
// Because of that issue, the `Object.create()` call had to be removed.
// It didn't result in any drawbacks because the `{}` argument of that call
// means that the `PhoneNumber` class created here adds 0 new properties
// to the existing `PhoneNumber` class it attempts to extend here.
// Hence, the `Object.create()` call can be omitted
// and the `prototype` can just be copied over as is.
// PhoneNumber.prototype = Object.create(_PhoneNumber.prototype, {})
PhoneNumber.prototype = _PhoneNumber.prototype
PhoneNumber.prototype.constructor = PhoneNumber