soff-phone 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/co-Cmyehxbk.d.cts +10 -0
- package/dist/co-XlKvHbFg.d.ts +10 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/co.cjs +2 -0
- package/dist/locales/co.cjs.map +1 -0
- package/dist/locales/co.d.cts +2 -0
- package/dist/locales/co.d.ts +2 -0
- package/dist/locales/co.js +2 -0
- package/dist/locales/co.js.map +1 -0
- package/dist/locales/mx.cjs +2 -0
- package/dist/locales/mx.cjs.map +1 -0
- package/dist/locales/mx.d.cts +2 -0
- package/dist/locales/mx.d.ts +2 -0
- package/dist/locales/mx.js +2 -0
- package/dist/locales/mx.js.map +1 -0
- package/dist/mx-BaMV1Q-C.d.cts +10 -0
- package/dist/mx-gjjuvO94.d.ts +10 -0
- package/dist/types-ClMaPMkH.d.cts +11 -0
- package/dist/types-ClMaPMkH.d.ts +11 -0
- package/package.json +105 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Luis C. Rojas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# soff-phone
|
|
2
|
+
|
|
3
|
+
Lightweight, tree-shakeable phone number validation and formatting library for LATAM.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🌲 **Tree-shakeable**: Import only the locales you need
|
|
8
|
+
- 📦 **Zero dependencies**: Lightweight and fast
|
|
9
|
+
- 🇨🇴 **Colombia**: Mobile and landline validation
|
|
10
|
+
- 🇲🇽 **Mexico**: 10-digit validation
|
|
11
|
+
- âš¡ **Typescript**: Fully typed
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install soff-phone
|
|
17
|
+
# or
|
|
18
|
+
pnpm add soff-phone
|
|
19
|
+
# or
|
|
20
|
+
yarn add soff-phone
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Colombia 🇨🇴
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { validate } from 'soff-phone/co';
|
|
29
|
+
|
|
30
|
+
// Validate mobile
|
|
31
|
+
const mobile = validate('3001234567');
|
|
32
|
+
console.log(mobile);
|
|
33
|
+
// { isValid: true, type: 'mobile', formatted: '3001234567' }
|
|
34
|
+
|
|
35
|
+
// Validate landline
|
|
36
|
+
const landline = validate('6011234567');
|
|
37
|
+
console.log(landline);
|
|
38
|
+
// { isValid: true, type: 'landline', formatted: '6011234567' }
|
|
39
|
+
|
|
40
|
+
// Format E.164
|
|
41
|
+
const e164 = validate('3001234567', { format: 'e164' });
|
|
42
|
+
console.log(e164.formatted); // +573001234567
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Mexico 🇲🇽
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { validate } from 'soff-phone/mx';
|
|
49
|
+
|
|
50
|
+
const result = validate('5512345678');
|
|
51
|
+
console.log(result);
|
|
52
|
+
// { isValid: true, type: 'unknown', formatted: '5512345678' }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Bundle Size
|
|
56
|
+
|
|
57
|
+
| Module | Size (minified) | Size (gzipped) |
|
|
58
|
+
| ------ | --------------- | -------------- |
|
|
59
|
+
| Core | ~0.5KB | ~0.3KB |
|
|
60
|
+
| CO | ~0.8KB | ~0.4KB |
|
|
61
|
+
| MX | ~0.8KB | ~0.4KB |
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT © [Luis C. Rojas](https://github.com/bledxs)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as PhoneOptions, P as PhoneValidationResult } from './types-ClMaPMkH.cjs';
|
|
2
|
+
|
|
3
|
+
declare function validate(phone: string, options?: PhoneOptions): PhoneValidationResult;
|
|
4
|
+
|
|
5
|
+
declare const co_validate: typeof validate;
|
|
6
|
+
declare namespace co {
|
|
7
|
+
export { co_validate as validate };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { co as c, validate as v };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as PhoneOptions, P as PhoneValidationResult } from './types-ClMaPMkH.js';
|
|
2
|
+
|
|
3
|
+
declare function validate(phone: string, options?: PhoneOptions): PhoneValidationResult;
|
|
4
|
+
|
|
5
|
+
declare const co_validate: typeof validate;
|
|
6
|
+
declare namespace co {
|
|
7
|
+
export { co_validate as validate };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { co as c, validate as v };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var u=Object.defineProperty;var m=(o,n)=>{for(var e in n)u(o,e,{get:n[e],enumerable:true});};function i(o){return o.replace(/\D/g,"")}function a(o,n){return `+${o}${n}`}var h={};m(h,{validate:()=>d});var l="57";function d(o,n){let e=i(o),t=e;if(e.startsWith(l)&&e.length>10&&(t=e.slice(l.length)),t.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let r="unknown";if(t.startsWith("3"))r="mobile";else if(t.startsWith("60"))r="landline";else return {isValid:false,error:"Invalid prefix for Colombia"};let f=t;return n?.format==="e164"?f=a(l,t):n?.format==="international"&&(f=`+${l} ${t}`),{isValid:true,type:r,formatted:f}}var p={};m(p,{validate:()=>c});var s="52";function c(o,n){let e=i(o),t=e;if(e.startsWith(s)&&e.length>10&&(t=e.slice(s.length)),t.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let r=t;return n?.format==="e164"?r=a(s,t):n?.format==="international"&&(r=`+${s} ${t}`),{isValid:true,type:"unknown",formatted:r}}exports.cleanPhone=i;exports.co=h;exports.formatE164=a;exports.mx=p;//# sourceMappingURL=index.cjs.map
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/utils.ts","../src/locales/co.ts","../src/locales/mx.ts"],"names":["cleanPhone","phone","formatE164","countryCode","co_exports","__export","validate","COUNTRY_CODE","options","cleaned","national","type","formatted","mx_exports"],"mappings":"0GAAO,SAASA,CAAAA,CAAWC,EAAuB,CAChD,OAAOA,EAAM,OAAA,CAAQ,KAAA,CAAO,EAAE,CAChC,CAEO,SAASC,CAAAA,CAAWC,CAAAA,CAAqBF,EAAuB,CACrE,OAAO,IAAIE,CAAW,CAAA,EAAGF,CAAK,CAAA,CAChC,KCNAG,CAAAA,CAAA,GAAAC,EAAAD,CAAAA,CAAA,CAAA,QAAA,CAAA,IAAAE,IAGA,IAAMC,CAAAA,CAAe,KAEd,SAASD,CAAAA,CAASL,EAAeO,CAAAA,CAA+C,CACrF,IAAMC,CAAAA,CAAUT,CAAAA,CAAWC,CAAK,CAAA,CAG5BS,CAAAA,CAAWD,CAAAA,CAKf,GAJIA,CAAAA,CAAQ,UAAA,CAAWF,CAAY,CAAA,EAAKE,CAAAA,CAAQ,OAAS,EAAA,GACvDC,CAAAA,CAAWD,EAAQ,KAAA,CAAMF,CAAAA,CAAa,MAAM,CAAA,CAAA,CAG1CG,CAAAA,CAAS,SAAW,EAAA,CACtB,OAAO,CAAE,OAAA,CAAS,KAAA,CAAO,MAAO,gCAAiC,CAAA,CAGnE,IAAIC,CAAAA,CAA0C,SAAA,CAG9C,GAAID,EAAS,UAAA,CAAW,GAAG,EACzBC,CAAAA,CAAO,QAAA,CAAA,KAAA,GAGAD,EAAS,UAAA,CAAW,IAAI,EAC/BC,CAAAA,CAAO,UAAA,CAAA,YAEA,CAAE,OAAA,CAAS,MAAO,KAAA,CAAO,6BAA8B,EAGhE,IAAIC,CAAAA,CAAYF,CAAAA,CAChB,OAAIF,CAAAA,EAAS,MAAA,GAAW,OACtBI,CAAAA,CAAYV,CAAAA,CAAWK,EAAcG,CAAQ,CAAA,CACpCF,GAAS,MAAA,GAAW,eAAA,GAC7BI,EAAY,CAAA,CAAA,EAAIL,CAAY,IAAIG,CAAQ,CAAA,CAAA,CAAA,CAGnC,CAAE,OAAA,CAAS,IAAA,CAAM,KAAAC,CAAAA,CAAM,SAAA,CAAAC,CAAU,CAC1C,CCvCA,IAAAC,EAAA,GAAAR,CAAAA,CAAAQ,EAAA,CAAA,QAAA,CAAA,IAAAP,CAAAA,CAAAA,CAAAA,CAGA,IAAMC,CAAAA,CAAe,IAAA,CAEd,SAASD,CAAAA,CAASL,CAAAA,CAAeO,EAA+C,CACrF,IAAMC,EAAUT,CAAAA,CAAWC,CAAK,EAG5BS,CAAAA,CAAWD,CAAAA,CAKf,GAJIA,CAAAA,CAAQ,UAAA,CAAWF,CAAY,GAAKE,CAAAA,CAAQ,MAAA,CAAS,KACvDC,CAAAA,CAAWD,CAAAA,CAAQ,MAAMF,CAAAA,CAAa,MAAM,GAG1CG,CAAAA,CAAS,MAAA,GAAW,GACtB,OAAO,CAAE,QAAS,KAAA,CAAO,KAAA,CAAO,gCAAiC,CAAA,CASnE,IAAIE,CAAAA,CAAYF,CAAAA,CAChB,OAAIF,CAAAA,EAAS,SAAW,MAAA,CACtBI,CAAAA,CAAYV,EAAWK,CAAAA,CAAcG,CAAQ,EACpCF,CAAAA,EAAS,MAAA,GAAW,kBAC7BI,CAAAA,CAAY,CAAA,CAAA,EAAIL,CAAY,CAAA,CAAA,EAAIG,CAAQ,IAGnC,CAAE,OAAA,CAAS,KAAM,IAAA,CAAM,SAAA,CAAW,SAAA,CAAAE,CAAU,CACrD","file":"index.cjs","sourcesContent":["export function cleanPhone(phone: string): string {\n return phone.replace(/\\D/g, '');\n}\n\nexport function formatE164(countryCode: string, phone: string): string {\n return `+${countryCode}${phone}`;\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '57';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n let type: 'mobile' | 'landline' | 'unknown' = 'unknown';\n\n // Mobile: Starts with 3\n if (national.startsWith('3')) {\n type = 'mobile';\n }\n // Landline: Starts with 60\n else if (national.startsWith('60')) {\n type = 'landline';\n } else {\n return { isValid: false, error: 'Invalid prefix for Colombia' };\n }\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type, formatted };\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '52';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n // Mexico doesn't strictly separate mobile/landline ranges as clearly in the first digit anymore for all cases,\n // but generally we can just validate length.\n // Distinction is harder without a massive database of area codes.\n // We will mark as 'unknown' type unless we want to implement complex area code logic.\n // For now, let's assume valid if 10 digits.\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type: 'unknown', formatted };\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { a as PhoneOptions, P as PhoneValidationResult } from './types-ClMaPMkH.cjs';
|
|
2
|
+
export { c as co } from './co-Cmyehxbk.cjs';
|
|
3
|
+
export { m as mx } from './mx-BaMV1Q-C.cjs';
|
|
4
|
+
|
|
5
|
+
declare function cleanPhone(phone: string): string;
|
|
6
|
+
declare function formatE164(countryCode: string, phone: string): string;
|
|
7
|
+
|
|
8
|
+
export { cleanPhone, formatE164 };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { a as PhoneOptions, P as PhoneValidationResult } from './types-ClMaPMkH.js';
|
|
2
|
+
export { c as co } from './co-XlKvHbFg.js';
|
|
3
|
+
export { m as mx } from './mx-gjjuvO94.js';
|
|
4
|
+
|
|
5
|
+
declare function cleanPhone(phone: string): string;
|
|
6
|
+
declare function formatE164(countryCode: string, phone: string): string;
|
|
7
|
+
|
|
8
|
+
export { cleanPhone, formatE164 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var u=Object.defineProperty;var m=(o,n)=>{for(var e in n)u(o,e,{get:n[e],enumerable:true});};function i(o){return o.replace(/\D/g,"")}function a(o,n){return `+${o}${n}`}var h={};m(h,{validate:()=>d});var l="57";function d(o,n){let e=i(o),t=e;if(e.startsWith(l)&&e.length>10&&(t=e.slice(l.length)),t.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let r="unknown";if(t.startsWith("3"))r="mobile";else if(t.startsWith("60"))r="landline";else return {isValid:false,error:"Invalid prefix for Colombia"};let f=t;return n?.format==="e164"?f=a(l,t):n?.format==="international"&&(f=`+${l} ${t}`),{isValid:true,type:r,formatted:f}}var p={};m(p,{validate:()=>c});var s="52";function c(o,n){let e=i(o),t=e;if(e.startsWith(s)&&e.length>10&&(t=e.slice(s.length)),t.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let r=t;return n?.format==="e164"?r=a(s,t):n?.format==="international"&&(r=`+${s} ${t}`),{isValid:true,type:"unknown",formatted:r}}export{i as cleanPhone,h as co,a as formatE164,p as mx};//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/utils.ts","../src/locales/co.ts","../src/locales/mx.ts"],"names":["cleanPhone","phone","formatE164","countryCode","co_exports","__export","validate","COUNTRY_CODE","options","cleaned","national","type","formatted","mx_exports"],"mappings":"6FAAO,SAASA,CAAAA,CAAWC,EAAuB,CAChD,OAAOA,EAAM,OAAA,CAAQ,KAAA,CAAO,EAAE,CAChC,CAEO,SAASC,CAAAA,CAAWC,CAAAA,CAAqBF,EAAuB,CACrE,OAAO,IAAIE,CAAW,CAAA,EAAGF,CAAK,CAAA,CAChC,KCNAG,CAAAA,CAAA,GAAAC,EAAAD,CAAAA,CAAA,CAAA,QAAA,CAAA,IAAAE,IAGA,IAAMC,CAAAA,CAAe,KAEd,SAASD,CAAAA,CAASL,EAAeO,CAAAA,CAA+C,CACrF,IAAMC,CAAAA,CAAUT,CAAAA,CAAWC,CAAK,CAAA,CAG5BS,CAAAA,CAAWD,CAAAA,CAKf,GAJIA,CAAAA,CAAQ,UAAA,CAAWF,CAAY,CAAA,EAAKE,CAAAA,CAAQ,OAAS,EAAA,GACvDC,CAAAA,CAAWD,EAAQ,KAAA,CAAMF,CAAAA,CAAa,MAAM,CAAA,CAAA,CAG1CG,CAAAA,CAAS,SAAW,EAAA,CACtB,OAAO,CAAE,OAAA,CAAS,KAAA,CAAO,MAAO,gCAAiC,CAAA,CAGnE,IAAIC,CAAAA,CAA0C,SAAA,CAG9C,GAAID,EAAS,UAAA,CAAW,GAAG,EACzBC,CAAAA,CAAO,QAAA,CAAA,KAAA,GAGAD,EAAS,UAAA,CAAW,IAAI,EAC/BC,CAAAA,CAAO,UAAA,CAAA,YAEA,CAAE,OAAA,CAAS,MAAO,KAAA,CAAO,6BAA8B,EAGhE,IAAIC,CAAAA,CAAYF,CAAAA,CAChB,OAAIF,CAAAA,EAAS,MAAA,GAAW,OACtBI,CAAAA,CAAYV,CAAAA,CAAWK,EAAcG,CAAQ,CAAA,CACpCF,GAAS,MAAA,GAAW,eAAA,GAC7BI,EAAY,CAAA,CAAA,EAAIL,CAAY,IAAIG,CAAQ,CAAA,CAAA,CAAA,CAGnC,CAAE,OAAA,CAAS,IAAA,CAAM,KAAAC,CAAAA,CAAM,SAAA,CAAAC,CAAU,CAC1C,CCvCA,IAAAC,EAAA,GAAAR,CAAAA,CAAAQ,EAAA,CAAA,QAAA,CAAA,IAAAP,CAAAA,CAAAA,CAAAA,CAGA,IAAMC,CAAAA,CAAe,IAAA,CAEd,SAASD,CAAAA,CAASL,CAAAA,CAAeO,EAA+C,CACrF,IAAMC,EAAUT,CAAAA,CAAWC,CAAK,EAG5BS,CAAAA,CAAWD,CAAAA,CAKf,GAJIA,CAAAA,CAAQ,UAAA,CAAWF,CAAY,GAAKE,CAAAA,CAAQ,MAAA,CAAS,KACvDC,CAAAA,CAAWD,CAAAA,CAAQ,MAAMF,CAAAA,CAAa,MAAM,GAG1CG,CAAAA,CAAS,MAAA,GAAW,GACtB,OAAO,CAAE,QAAS,KAAA,CAAO,KAAA,CAAO,gCAAiC,CAAA,CASnE,IAAIE,CAAAA,CAAYF,CAAAA,CAChB,OAAIF,CAAAA,EAAS,SAAW,MAAA,CACtBI,CAAAA,CAAYV,EAAWK,CAAAA,CAAcG,CAAQ,EACpCF,CAAAA,EAAS,MAAA,GAAW,kBAC7BI,CAAAA,CAAY,CAAA,CAAA,EAAIL,CAAY,CAAA,CAAA,EAAIG,CAAQ,IAGnC,CAAE,OAAA,CAAS,KAAM,IAAA,CAAM,SAAA,CAAW,SAAA,CAAAE,CAAU,CACrD","file":"index.js","sourcesContent":["export function cleanPhone(phone: string): string {\n return phone.replace(/\\D/g, '');\n}\n\nexport function formatE164(countryCode: string, phone: string): string {\n return `+${countryCode}${phone}`;\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '57';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n let type: 'mobile' | 'landline' | 'unknown' = 'unknown';\n\n // Mobile: Starts with 3\n if (national.startsWith('3')) {\n type = 'mobile';\n }\n // Landline: Starts with 60\n else if (national.startsWith('60')) {\n type = 'landline';\n } else {\n return { isValid: false, error: 'Invalid prefix for Colombia' };\n }\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type, formatted };\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '52';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n // Mexico doesn't strictly separate mobile/landline ranges as clearly in the first digit anymore for all cases,\n // but generally we can just validate length.\n // Distinction is harder without a massive database of area codes.\n // We will mark as 'unknown' type unless we want to implement complex area code logic.\n // For now, let's assume valid if 10 digits.\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type: 'unknown', formatted };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function a(e){return e.replace(/\D/g,"")}function s(e,n){return `+${e}${n}`}var r="57";function m(e,n){let i=a(e),t=i;if(i.startsWith(r)&&i.length>10&&(t=i.slice(r.length)),t.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let o="unknown";if(t.startsWith("3"))o="mobile";else if(t.startsWith("60"))o="landline";else return {isValid:false,error:"Invalid prefix for Colombia"};let l=t;return n?.format==="e164"?l=s(r,t):n?.format==="international"&&(l=`+${r} ${t}`),{isValid:true,type:o,formatted:l}}exports.validate=m;//# sourceMappingURL=co.cjs.map
|
|
2
|
+
//# sourceMappingURL=co.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils.ts","../../src/locales/co.ts"],"names":["cleanPhone","phone","formatE164","countryCode","COUNTRY_CODE","validate","options","cleaned","national","type","formatted"],"mappings":"aAAO,SAASA,CAAAA,CAAWC,CAAAA,CAAuB,CAChD,OAAOA,CAAAA,CAAM,QAAQ,KAAA,CAAO,EAAE,CAChC,CAEO,SAASC,CAAAA,CAAWC,EAAqBF,CAAAA,CAAuB,CACrE,OAAO,CAAA,CAAA,EAAIE,CAAW,CAAA,EAAGF,CAAK,CAAA,CAChC,CCHA,IAAMG,CAAAA,CAAe,IAAA,CAEd,SAASC,CAAAA,CAASJ,EAAeK,CAAAA,CAA+C,CACrF,IAAMC,CAAAA,CAAUP,CAAAA,CAAWC,CAAK,EAG5BO,CAAAA,CAAWD,CAAAA,CAKf,GAJIA,CAAAA,CAAQ,UAAA,CAAWH,CAAY,GAAKG,CAAAA,CAAQ,MAAA,CAAS,EAAA,GACvDC,CAAAA,CAAWD,CAAAA,CAAQ,KAAA,CAAMH,CAAAA,CAAa,MAAM,CAAA,CAAA,CAG1CI,CAAAA,CAAS,MAAA,GAAW,EAAA,CACtB,OAAO,CAAE,QAAS,KAAA,CAAO,KAAA,CAAO,gCAAiC,CAAA,CAGnE,IAAIC,CAAAA,CAA0C,UAG9C,GAAID,CAAAA,CAAS,UAAA,CAAW,GAAG,CAAA,CACzBC,CAAAA,CAAO,iBAGAD,CAAAA,CAAS,UAAA,CAAW,IAAI,CAAA,CAC/BC,CAAAA,CAAO,UAAA,CAAA,KAEP,OAAO,CAAE,OAAA,CAAS,KAAA,CAAO,KAAA,CAAO,6BAA8B,CAAA,CAGhE,IAAIC,EAAYF,CAAAA,CAChB,OAAIF,CAAAA,EAAS,MAAA,GAAW,MAAA,CACtBI,CAAAA,CAAYR,EAAWE,CAAAA,CAAcI,CAAQ,CAAA,CACpCF,CAAAA,EAAS,MAAA,GAAW,eAAA,GAC7BI,EAAY,CAAA,CAAA,EAAIN,CAAY,CAAA,CAAA,EAAII,CAAQ,CAAA,CAAA,CAAA,CAGnC,CAAE,OAAA,CAAS,IAAA,CAAM,IAAA,CAAAC,CAAAA,CAAM,SAAA,CAAAC,CAAU,CAC1C","file":"co.cjs","sourcesContent":["export function cleanPhone(phone: string): string {\n return phone.replace(/\\D/g, '');\n}\n\nexport function formatE164(countryCode: string, phone: string): string {\n return `+${countryCode}${phone}`;\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '57';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n let type: 'mobile' | 'landline' | 'unknown' = 'unknown';\n\n // Mobile: Starts with 3\n if (national.startsWith('3')) {\n type = 'mobile';\n }\n // Landline: Starts with 60\n else if (national.startsWith('60')) {\n type = 'landline';\n } else {\n return { isValid: false, error: 'Invalid prefix for Colombia' };\n }\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type, formatted };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function a(e){return e.replace(/\D/g,"")}function s(e,n){return `+${e}${n}`}var r="57";function m(e,n){let i=a(e),t=i;if(i.startsWith(r)&&i.length>10&&(t=i.slice(r.length)),t.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let o="unknown";if(t.startsWith("3"))o="mobile";else if(t.startsWith("60"))o="landline";else return {isValid:false,error:"Invalid prefix for Colombia"};let l=t;return n?.format==="e164"?l=s(r,t):n?.format==="international"&&(l=`+${r} ${t}`),{isValid:true,type:o,formatted:l}}export{m as validate};//# sourceMappingURL=co.js.map
|
|
2
|
+
//# sourceMappingURL=co.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils.ts","../../src/locales/co.ts"],"names":["cleanPhone","phone","formatE164","countryCode","COUNTRY_CODE","validate","options","cleaned","national","type","formatted"],"mappings":"AAAO,SAASA,CAAAA,CAAWC,CAAAA,CAAuB,CAChD,OAAOA,CAAAA,CAAM,QAAQ,KAAA,CAAO,EAAE,CAChC,CAEO,SAASC,CAAAA,CAAWC,EAAqBF,CAAAA,CAAuB,CACrE,OAAO,CAAA,CAAA,EAAIE,CAAW,CAAA,EAAGF,CAAK,CAAA,CAChC,CCHA,IAAMG,CAAAA,CAAe,IAAA,CAEd,SAASC,CAAAA,CAASJ,EAAeK,CAAAA,CAA+C,CACrF,IAAMC,CAAAA,CAAUP,CAAAA,CAAWC,CAAK,EAG5BO,CAAAA,CAAWD,CAAAA,CAKf,GAJIA,CAAAA,CAAQ,UAAA,CAAWH,CAAY,GAAKG,CAAAA,CAAQ,MAAA,CAAS,EAAA,GACvDC,CAAAA,CAAWD,CAAAA,CAAQ,KAAA,CAAMH,CAAAA,CAAa,MAAM,CAAA,CAAA,CAG1CI,CAAAA,CAAS,MAAA,GAAW,EAAA,CACtB,OAAO,CAAE,QAAS,KAAA,CAAO,KAAA,CAAO,gCAAiC,CAAA,CAGnE,IAAIC,CAAAA,CAA0C,UAG9C,GAAID,CAAAA,CAAS,UAAA,CAAW,GAAG,CAAA,CACzBC,CAAAA,CAAO,iBAGAD,CAAAA,CAAS,UAAA,CAAW,IAAI,CAAA,CAC/BC,CAAAA,CAAO,UAAA,CAAA,KAEP,OAAO,CAAE,OAAA,CAAS,KAAA,CAAO,KAAA,CAAO,6BAA8B,CAAA,CAGhE,IAAIC,EAAYF,CAAAA,CAChB,OAAIF,CAAAA,EAAS,MAAA,GAAW,MAAA,CACtBI,CAAAA,CAAYR,EAAWE,CAAAA,CAAcI,CAAQ,CAAA,CACpCF,CAAAA,EAAS,MAAA,GAAW,eAAA,GAC7BI,EAAY,CAAA,CAAA,EAAIN,CAAY,CAAA,CAAA,EAAII,CAAQ,CAAA,CAAA,CAAA,CAGnC,CAAE,OAAA,CAAS,IAAA,CAAM,IAAA,CAAAC,CAAAA,CAAM,SAAA,CAAAC,CAAU,CAC1C","file":"co.js","sourcesContent":["export function cleanPhone(phone: string): string {\n return phone.replace(/\\D/g, '');\n}\n\nexport function formatE164(countryCode: string, phone: string): string {\n return `+${countryCode}${phone}`;\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '57';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n let type: 'mobile' | 'landline' | 'unknown' = 'unknown';\n\n // Mobile: Starts with 3\n if (national.startsWith('3')) {\n type = 'mobile';\n }\n // Landline: Starts with 60\n else if (national.startsWith('60')) {\n type = 'landline';\n } else {\n return { isValid: false, error: 'Invalid prefix for Colombia' };\n }\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type, formatted };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function a(t){return t.replace(/\D/g,"")}function s(t,n){return `+${t}${n}`}var i="52";function u(t,n){let r=a(t),e=r;if(r.startsWith(i)&&r.length>10&&(e=r.slice(i.length)),e.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let o=e;return n?.format==="e164"?o=s(i,e):n?.format==="international"&&(o=`+${i} ${e}`),{isValid:true,type:"unknown",formatted:o}}exports.validate=u;//# sourceMappingURL=mx.cjs.map
|
|
2
|
+
//# sourceMappingURL=mx.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils.ts","../../src/locales/mx.ts"],"names":["cleanPhone","phone","formatE164","countryCode","COUNTRY_CODE","validate","options","cleaned","national","formatted"],"mappings":"aAAO,SAASA,EAAWC,CAAAA,CAAuB,CAChD,OAAOA,CAAAA,CAAM,OAAA,CAAQ,MAAO,EAAE,CAChC,CAEO,SAASC,CAAAA,CAAWC,EAAqBF,CAAAA,CAAuB,CACrE,OAAO,CAAA,CAAA,EAAIE,CAAW,GAAGF,CAAK,CAAA,CAChC,CCHA,IAAMG,EAAe,IAAA,CAEd,SAASC,EAASJ,CAAAA,CAAeK,CAAAA,CAA+C,CACrF,IAAMC,CAAAA,CAAUP,EAAWC,CAAK,CAAA,CAG5BO,EAAWD,CAAAA,CAKf,GAJIA,EAAQ,UAAA,CAAWH,CAAY,GAAKG,CAAAA,CAAQ,MAAA,CAAS,EAAA,GACvDC,CAAAA,CAAWD,EAAQ,KAAA,CAAMH,CAAAA,CAAa,MAAM,CAAA,CAAA,CAG1CI,CAAAA,CAAS,SAAW,EAAA,CACtB,OAAO,CAAE,OAAA,CAAS,KAAA,CAAO,MAAO,gCAAiC,CAAA,CASnE,IAAIC,CAAAA,CAAYD,CAAAA,CAChB,OAAIF,CAAAA,EAAS,MAAA,GAAW,OACtBG,CAAAA,CAAYP,CAAAA,CAAWE,EAAcI,CAAQ,CAAA,CACpCF,GAAS,MAAA,GAAW,eAAA,GAC7BG,EAAY,CAAA,CAAA,EAAIL,CAAY,IAAII,CAAQ,CAAA,CAAA,CAAA,CAGnC,CAAE,OAAA,CAAS,IAAA,CAAM,KAAM,SAAA,CAAW,SAAA,CAAAC,CAAU,CACrD","file":"mx.cjs","sourcesContent":["export function cleanPhone(phone: string): string {\n return phone.replace(/\\D/g, '');\n}\n\nexport function formatE164(countryCode: string, phone: string): string {\n return `+${countryCode}${phone}`;\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '52';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n // Mexico doesn't strictly separate mobile/landline ranges as clearly in the first digit anymore for all cases,\n // but generally we can just validate length.\n // Distinction is harder without a massive database of area codes.\n // We will mark as 'unknown' type unless we want to implement complex area code logic.\n // For now, let's assume valid if 10 digits.\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type: 'unknown', formatted };\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function a(t){return t.replace(/\D/g,"")}function s(t,n){return `+${t}${n}`}var i="52";function u(t,n){let r=a(t),e=r;if(r.startsWith(i)&&r.length>10&&(e=r.slice(i.length)),e.length!==10)return {isValid:false,error:"Phone number must be 10 digits"};let o=e;return n?.format==="e164"?o=s(i,e):n?.format==="international"&&(o=`+${i} ${e}`),{isValid:true,type:"unknown",formatted:o}}export{u as validate};//# sourceMappingURL=mx.js.map
|
|
2
|
+
//# sourceMappingURL=mx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/utils.ts","../../src/locales/mx.ts"],"names":["cleanPhone","phone","formatE164","countryCode","COUNTRY_CODE","validate","options","cleaned","national","formatted"],"mappings":"AAAO,SAASA,EAAWC,CAAAA,CAAuB,CAChD,OAAOA,CAAAA,CAAM,OAAA,CAAQ,MAAO,EAAE,CAChC,CAEO,SAASC,CAAAA,CAAWC,EAAqBF,CAAAA,CAAuB,CACrE,OAAO,CAAA,CAAA,EAAIE,CAAW,GAAGF,CAAK,CAAA,CAChC,CCHA,IAAMG,EAAe,IAAA,CAEd,SAASC,EAASJ,CAAAA,CAAeK,CAAAA,CAA+C,CACrF,IAAMC,CAAAA,CAAUP,EAAWC,CAAK,CAAA,CAG5BO,EAAWD,CAAAA,CAKf,GAJIA,EAAQ,UAAA,CAAWH,CAAY,GAAKG,CAAAA,CAAQ,MAAA,CAAS,EAAA,GACvDC,CAAAA,CAAWD,EAAQ,KAAA,CAAMH,CAAAA,CAAa,MAAM,CAAA,CAAA,CAG1CI,CAAAA,CAAS,SAAW,EAAA,CACtB,OAAO,CAAE,OAAA,CAAS,KAAA,CAAO,MAAO,gCAAiC,CAAA,CASnE,IAAIC,CAAAA,CAAYD,CAAAA,CAChB,OAAIF,CAAAA,EAAS,MAAA,GAAW,OACtBG,CAAAA,CAAYP,CAAAA,CAAWE,EAAcI,CAAQ,CAAA,CACpCF,GAAS,MAAA,GAAW,eAAA,GAC7BG,EAAY,CAAA,CAAA,EAAIL,CAAY,IAAII,CAAQ,CAAA,CAAA,CAAA,CAGnC,CAAE,OAAA,CAAS,IAAA,CAAM,KAAM,SAAA,CAAW,SAAA,CAAAC,CAAU,CACrD","file":"mx.js","sourcesContent":["export function cleanPhone(phone: string): string {\n return phone.replace(/\\D/g, '');\n}\n\nexport function formatE164(countryCode: string, phone: string): string {\n return `+${countryCode}${phone}`;\n}\n","import type { PhoneValidationResult, PhoneOptions } from '../core/types.js';\nimport { cleanPhone, formatE164 } from '../core/utils.js';\n\nconst COUNTRY_CODE = '52';\n\nexport function validate(phone: string, options?: PhoneOptions): PhoneValidationResult {\n const cleaned = cleanPhone(phone);\n\n // Check if it includes country code\n let national = cleaned;\n if (cleaned.startsWith(COUNTRY_CODE) && cleaned.length > 10) {\n national = cleaned.slice(COUNTRY_CODE.length);\n }\n\n if (national.length !== 10) {\n return { isValid: false, error: 'Phone number must be 10 digits' };\n }\n\n // Mexico doesn't strictly separate mobile/landline ranges as clearly in the first digit anymore for all cases,\n // but generally we can just validate length.\n // Distinction is harder without a massive database of area codes.\n // We will mark as 'unknown' type unless we want to implement complex area code logic.\n // For now, let's assume valid if 10 digits.\n\n let formatted = national;\n if (options?.format === 'e164') {\n formatted = formatE164(COUNTRY_CODE, national);\n } else if (options?.format === 'international') {\n formatted = `+${COUNTRY_CODE} ${national}`;\n }\n\n return { isValid: true, type: 'unknown', formatted };\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as PhoneOptions, P as PhoneValidationResult } from './types-ClMaPMkH.cjs';
|
|
2
|
+
|
|
3
|
+
declare function validate(phone: string, options?: PhoneOptions): PhoneValidationResult;
|
|
4
|
+
|
|
5
|
+
declare const mx_validate: typeof validate;
|
|
6
|
+
declare namespace mx {
|
|
7
|
+
export { mx_validate as validate };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { mx as m, validate as v };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as PhoneOptions, P as PhoneValidationResult } from './types-ClMaPMkH.js';
|
|
2
|
+
|
|
3
|
+
declare function validate(phone: string, options?: PhoneOptions): PhoneValidationResult;
|
|
4
|
+
|
|
5
|
+
declare const mx_validate: typeof validate;
|
|
6
|
+
declare namespace mx {
|
|
7
|
+
export { mx_validate as validate };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { mx as m, validate as v };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface PhoneValidationResult {
|
|
2
|
+
isValid: boolean;
|
|
3
|
+
formatted?: string;
|
|
4
|
+
type?: 'mobile' | 'landline' | 'unknown';
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
interface PhoneOptions {
|
|
8
|
+
format?: 'national' | 'international' | 'e164';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { PhoneValidationResult as P, PhoneOptions as a };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface PhoneValidationResult {
|
|
2
|
+
isValid: boolean;
|
|
3
|
+
formatted?: string;
|
|
4
|
+
type?: 'mobile' | 'landline' | 'unknown';
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
interface PhoneOptions {
|
|
8
|
+
format?: 'national' | 'international' | 'e164';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { PhoneValidationResult as P, PhoneOptions as a };
|
package/package.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "soff-phone",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Lightweight phone number validation and formatting library for LATAM",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./co": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/locales/co.d.ts",
|
|
24
|
+
"default": "./dist/locales/co.js"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/locales/co.d.cts",
|
|
28
|
+
"default": "./dist/locales/co.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./mx": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/locales/mx.d.ts",
|
|
34
|
+
"default": "./dist/locales/mx.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/locales/mx.d.cts",
|
|
38
|
+
"default": "./dist/locales/mx.cjs"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsup",
|
|
47
|
+
"dev": "tsup --watch",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"test:coverage": "vitest --coverage",
|
|
51
|
+
"type-check": "tsc --noEmit",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "eslint . --fix",
|
|
54
|
+
"clean": "rimraf dist coverage .turbo",
|
|
55
|
+
"format": "prettier --write ."
|
|
56
|
+
},
|
|
57
|
+
"lint-staged": {
|
|
58
|
+
"*.{ts,tsx,js,jsx}": [
|
|
59
|
+
"eslint --fix",
|
|
60
|
+
"prettier --write"
|
|
61
|
+
],
|
|
62
|
+
"*.{json,md,yml,yaml}": [
|
|
63
|
+
"prettier --write"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"keywords": [
|
|
67
|
+
"phone",
|
|
68
|
+
"validation",
|
|
69
|
+
"formatting",
|
|
70
|
+
"colombia",
|
|
71
|
+
"mexico",
|
|
72
|
+
"latam",
|
|
73
|
+
"typescript",
|
|
74
|
+
"tree-shaking",
|
|
75
|
+
"lightweight"
|
|
76
|
+
],
|
|
77
|
+
"author": "Luis C. Rojas",
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"repository": {
|
|
80
|
+
"type": "git",
|
|
81
|
+
"url": "git+https://github.com/bledxs/soff-monorepo.git",
|
|
82
|
+
"directory": "packages/soff-phone"
|
|
83
|
+
},
|
|
84
|
+
"bugs": {
|
|
85
|
+
"url": "https://github.com/bledxs/soff-monorepo/issues"
|
|
86
|
+
},
|
|
87
|
+
"homepage": "https://github.com/bledxs/soff-monorepo/tree/master/packages/soff-phone#readme",
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=20"
|
|
90
|
+
},
|
|
91
|
+
"devDependencies": {
|
|
92
|
+
"@eslint/js": "^9.39.1",
|
|
93
|
+
"@soff/tsconfig": "*",
|
|
94
|
+
"@vitest/coverage-v8": "^4.0.14",
|
|
95
|
+
"eslint": "^9.39.1",
|
|
96
|
+
"eslint-config-prettier": "^10.1.8",
|
|
97
|
+
"globals": "^16.5.0",
|
|
98
|
+
"prettier": "^3.7.3",
|
|
99
|
+
"rimraf": "^6.0.1",
|
|
100
|
+
"tsup": "^8.5.1",
|
|
101
|
+
"typescript": "^5.9.3",
|
|
102
|
+
"typescript-eslint": "^8.48.0",
|
|
103
|
+
"vitest": "^4.0.14"
|
|
104
|
+
}
|
|
105
|
+
}
|