added definitions for phone

This commit is contained in:
Hagai Cohen
2016-08-15 14:02:33 +03:00
parent 991f2baad5
commit 09e39bfd0f
3 changed files with 37 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
// Type definitions for phone 1.0.8
// Project: https://github.com/aftership/phone
// Definitions by: Hagai Cohen <https://github.com/DxCx>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export default function phone(phoneNumber: string, countryCode?: string): Array<string>;
+12
View File
@@ -0,0 +1,12 @@
import phone from 'phone';
phone('+852 6569-8900'); // return ['+85265698900', 'HKG']
phone('(817) 569-8900'); // return ['+18175698900, 'USA']
phone('(817) 569-8900', ''); // return ['+18175698900, 'USA']
phone('(817) 569-8900', 'USA'); // return ['+18175698900', 'USA']
phone('(817) 569-8900', 'HKG'); // return []
phone('+1(817) 569-8900', 'HKG'); // return [], as it is not a valid HKG mobile phone number
phone('+1(817) 569-8900', ''); // return ['+18175698900', 'USA']
phone('(817) 569-8900', ''); // return ['+18175698900', 'USA']
phone('6123-6123', ''); // return [], as default country is USA
phone('6123-6123', 'HKG'); // return ['+85261236123', 'HKG']
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"phone-tests.ts"
]
}