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

joi-phone-number

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-phone-number - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

5

lib/__tests__/joiPhoneNumber.test.js

@@ -15,3 +15,3 @@ 'use strict';

const joi = Joi.extend(JoiPhoneNumber);
const schema = joi.string().phoneNumber();
let schema = joi.string().phoneNumber();

@@ -32,2 +32,5 @@ expect(schema.validate('').error).toBeInstanceOf(Error);

expect(schema.validate('011 69 37 83').error).toBeUndefined(); // Should work with the BE fallback
schema = joi.string().phoneNumber({format: 'international'});
expect(schema.validate('+324').error).toBeInstanceOf(Error);
});

@@ -34,0 +37,0 @@

3

lib/index.js

@@ -6,2 +6,3 @@ 'use strict';

const PhoneNumberFormat = LibPhoneNumber.PhoneNumberFormat;
const LibPhoneNumberError = LibPhoneNumber.Error;

@@ -57,3 +58,3 @@ const internals = {};

} catch (err) {
const knownErrors = ['Invalid country calling code', 'The string supplied did not seem to be a phone number', 'StrictPhoneNumber'];
const knownErrors = [...Object.values(LibPhoneNumberError), 'StrictPhoneNumber'];
// We ignore the next line for line coverage since we should always hit it but if we have a regression in our code we still want to surface that instead of just returning the default error

@@ -60,0 +61,0 @@ /* istanbul ignore next */

{
"name": "joi-phone-number",
"version": "4.0.1",
"version": "4.1.0",
"description": "Phone number validation rule for Joi",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/Salesflare/joi-phone-number",

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