joi-phone-number
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -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 @@ |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12140
166