Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

phone

Package Overview
Dependencies
Maintainers
2
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phone - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

4

dist/index.d.ts
import countryPhoneData from './data/country_phone_data';
interface PhoneInvalidResult {
isValid: false;
phoneNumber: null;
countryIso2: null;
countryIso3: null;
countryCode: null;
}

@@ -5,0 +9,0 @@ interface PhoneValidResult {

@@ -22,3 +22,7 @@ "use strict";

const invalidResult = {
isValid: false
isValid: false,
phoneNumber: null,
countryIso2: null,
countryIso3: null,
countryCode: null
};

@@ -25,0 +29,0 @@ let processedPhoneNumber = (typeof phoneNumber !== 'string') ? '' : phoneNumber.trim();

2

package.json
{
"name": "phone",
"version": "3.1.0",
"version": "3.1.1",
"description": "With a given country and phone number, validate and format the phone number to E.164 standard",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -184,3 +184,3 @@ # Phone · [![Build Status](https://travis-ci.org/AfterShip/phone.svg?branch=v2)](https://travis-ci.org/AfterShip/phone) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)

```javascript
```typescript
const {phone} = require('phone');

@@ -191,19 +191,3 @@

import {phone} from 'phone';
```
```typescript
interface PhoneInvalidResult {
isValid: false;
}
interface PhoneValidResult {
isValid: true;
phoneNumber: string;
countryIso2: string;
countryIso3: string;
countryCode: string;
}
type PhoneResult = PhoneInvalidResult | PhoneValidResult;
phone(phoneNumber: string, { country, validateMobilePrefix, strictDetection }?: {

@@ -213,3 +197,3 @@ country?: string;

strictDetection?: boolean;
}): PhoneResult
})
```

@@ -228,5 +212,6 @@

#### Valid result
```javascript
{
```typescript
type PhoneResult = PhoneInvalidResult | PhoneValidResult;
interface PhoneValidResult {
isValid: true;

@@ -238,2 +223,10 @@ phoneNumber: string;

}
interface PhoneInvalidResult {
isValid: false;
phoneNumber: null;
countryIso2: null;
countryIso3: null;
countryCode: null;
}
```

@@ -249,15 +242,2 @@

#### Invalid result
```javascript
{
isValid: false;
}
```
Parameter | Type | Description
--- | --- | ---
isValid | Boolean | To indicate if the result valid
[comment]: <> (## Demo)

@@ -267,3 +247,2 @@

## Test

@@ -329,6 +308,7 @@

Version | Interface
--- | ---
v2 | [phoneNumber, country]
v3 | {isValid: false} or {isValid: true, phoneNumber: string, countryIso2: string, countryIso3: string, countryCode: string}
Version | Result | Interface
--- | --- | ---
v2 | - | [phoneNumber, country]
v3 | Valid | {isValid: true, phoneNumber: string, countryIso2: string, countryIso3: string, countryCode: string}
v3 | Invalid | {isValid: false, phoneNumber: null, countryIso2: null, countryIso3: null, countryCode: null}

@@ -335,0 +315,0 @@ #### allowLandline vs validateMobilePrefix

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc