fastest-validator
Advanced tools
Comparing version 0.6.14 to 0.6.15
-------------------------------------------------- | ||
<a name="0.6.15"></a> | ||
# 0.6.15 (2019-02-13) | ||
## Changes | ||
- fix `uuid` rule. [#60](https://github.com/icebob/fastest-validator/issues/60) | ||
- fix typescript definitions. [#59](https://github.com/icebob/fastest-validator/issues/59) | ||
-------------------------------------------------- | ||
<a name="0.6.14"></a> | ||
@@ -3,0 +11,0 @@ # 0.6.14 (2019-02-07) |
@@ -416,3 +416,2 @@ (function (global, factory) { | ||
* @param {Object} schema | ||
* @throws {Error} Invalid schema | ||
*/ | ||
@@ -422,18 +421,19 @@ Validator.prototype.compile = function(schema) { | ||
var self = this; | ||
var rules; | ||
if (Array.isArray(schema)) { | ||
// Multiple schemas | ||
if (schema.length == 0) { | ||
throw new Error("If the schema is an Array, must contain at least one element!"); | ||
} | ||
if (schema.length == 0) | ||
{ throw new Error("If the schema is an Array, must contain at least one element!"); } | ||
var rules = flatten_1(schema.map(function (r) { return this$1._processRule(r, null, false); })); | ||
return this._checkWrapper(rules, true); | ||
return this._checkWrapper(flatten_1(schema.map(function (r) { return this$1._processRule(r, null, false); })), true); | ||
} else if (schema != null && typeof schema === "object") { | ||
var rules$1 = flatten_1(Object.keys(schema).map(function (name) { return this$1._processRule(schema[name], name, false); })); | ||
return this._checkWrapper(rules$1); | ||
rules = flatten_1(Object.keys(schema).map(function (name) { return self._processRule(schema[name], name, false); })); | ||
} else | ||
{ throw new Error("Invalid schema!"); } | ||
} | ||
throw new Error("Invalid schema!"); | ||
return this._checkWrapper(rules); | ||
}; | ||
@@ -451,2 +451,8 @@ | ||
if (typeof rule === "string") { | ||
rule = { | ||
type: rule | ||
}; | ||
} | ||
if (Array.isArray(rule)) { | ||
@@ -465,20 +471,13 @@ // Compile the multiple schemas | ||
if (typeof rule === "string") { | ||
rule = { | ||
type: rule | ||
}; | ||
} | ||
if (this.rules[rule.type]) { | ||
checks.push({ | ||
fn: this.rules[rule.type], | ||
type: rule.type, | ||
name: name, | ||
schema: rule, | ||
iterate: iterate | ||
}); | ||
} else | ||
{ throw new Error("Invalid '" + rule.type + "' type in validator schema!"); } | ||
if (!this.rules[rule.type]) { | ||
throw new Error("Invalid '" + rule.type + "' type in validator schema!"); | ||
} | ||
checks.push({ | ||
fn: this.rules[rule.type], | ||
type: rule.type, | ||
name: name, | ||
schema: rule, | ||
iterate: iterate | ||
}); | ||
// Nested schema | ||
@@ -485,0 +484,0 @@ if (rule.type === "object" && rule.props) { |
@@ -1,1 +0,1 @@ | ||
"use strict";function u(){function e(e){return"string"!=typeof e?this.makeError("string"):!!E.test(e)||this.makeError("url")}function t(e,t){if("string"!=typeof e)return this.makeError("string");var r=e.length;return!1===t.empty&&0===r?this.makeError("stringEmpty"):null!=t.min&&r<t.min?this.makeError("stringMin",t.min,r):null!=t.max&&r>t.max?this.makeError("stringMax",t.max,r):null!=t.length&&r!==t.length?this.makeError("stringLength",t.length,r):null==t.pattern||t.pattern.test(e)?null!=t.contains&&-1===e.indexOf(t.contains)?this.makeError("stringContains",t.contains):null==t.enum||-1!==t.enum.indexOf(e)||this.makeError("stringEnum",t.enum):this.makeError("stringPattern",t.pattern)}function r(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)||this.makeError("object")}function n(e,t){return!0===t.convert&&"number"!=typeof e&&(e=Number(e)),"number"!=typeof e||isNaN(e)||!isFinite(e)?this.makeError("number"):null!=t.min&&e<t.min?this.makeError("numberMin",t.min,e):null!=t.max&&e>t.max?this.makeError("numberMax",t.max,e):null!=t.equal&&e!==t.equal?this.makeError("numberEqual",t.equal,e):null!=t.notEqual&&e===t.notEqual?this.makeError("numberNotEqual",t.notEqual):!0===t.integer&&0!=e%1?this.makeError("numberInteger",e):!0===t.positive&&0>=e?this.makeError("numberPositive",e):!(!0===t.negative&&0<=e)||this.makeError("numberNegative",e)}function i(e){return"function"==typeof e||this.makeError("function")}function a(e){return null===e||void 0===e||this.makeError("forbidden")}function o(e,t){return"string"!=typeof e?this.makeError("string"):!!("precise"==t.mode?b:g).test(e)||this.makeError("email")}function l(e,t){return!0!==t.convert||e instanceof Date||(e=new Date(e)),e instanceof Date&&!isNaN(e.getTime())||this.makeError("date")}function u(e,t){return t.check.call(this,e,t)}function s(e,t){return!0===t.convert&&"boolean"!=typeof e&&(1===e||0===e||"true"===e||"false"===e||"1"===e||"0"===e||"on"===e||"off"===e)||("boolean"==typeof e||this.makeError("boolean"))}function f(e,t){if(!Array.isArray(e))return this.makeError("array");var r=e.length;if(!1===t.empty&&0===r)return this.makeError("arrayEmpty");if(null!=t.min&&r<t.min)return this.makeError("arrayMin",t.min,r);if(null!=t.max&&r>t.max)return this.makeError("arrayMax",t.max,r);if(null!=t.length&&r!==t.length)return this.makeError("arrayLength",t.length,r);if(null!=t.contains&&-1===e.indexOf(t.contains))return this.makeError("arrayContains",t.contains);if(null!=t.enum)for(r=0;r<e.length;r++)if(-1===t.enum.indexOf(e[r]))return this.makeError("arrayEnum",e[r],t.enum);return!0}function m(){return!0}function h(e,t){t=t||[];for(var r=0;r<e.length;++r)Array.isArray(e[r])?h(e[r],t):t.push(e[r]);return t}function c(e,t){for(var r in t)"object"==typeof t[r]&&null!==t[r]?(e[r]=e[r]||{},c(e[r],t[r])):e[r]=t[r];return e}function d(h){this.opts={messages:y},h&&p(this.opts,h),this.messages=this.opts.messages,this.rules={any:m,array:f,boolean:s,custom:u,date:l,email:o,forbidden:a,function:i,number:n,object:r,string:t,url:e}}var p=c,y={required:"The '{field}' field is required!",string:"The '{field}' field must be a string!",stringEmpty:"The '{field}' field must not be empty!",stringMin:"The '{field}' field length must be larger than or equal to {expected} characters long!",stringMax:"The '{field}' field length must be less than or equal to {expected} characters long!",stringLength:"The '{field}' field length must be {expected} characters long!",stringPattern:"The '{field}' field fails to match the required pattern!",stringContains:"The '{field}' field must contain the '{expected}' text!",stringEnum:"The '{field}' field does not match any of the allowed values!",number:"The '{field}' field must be a number!",numberMin:"The '{field}' field must be larger than or equal to {expected}!",numberMax:"The '{field}' field must be less than or equal to {expected}!",numberEqual:"The '{field}' field must be equal with {expected}!",numberNotEqual:"The '{field}' field can't be equal with {expected}!",numberInteger:"The '{field}' field must be an integer!",numberPositive:"The '{field}' field must be a positive number!",numberNegative:"The '{field}' field must be a negative number!",array:"The '{field}' field must be an array!",arrayEmpty:"The '{field}' field must not be an empty array!",arrayMin:"The '{field}' field must contain at least {expected} items!",arrayMax:"The '{field}' field must contain less than or equal to {expected} items!",arrayLength:"The '{field}' field must contain {expected} items!",arrayContains:"The '{field}' field must contain the '{expected}' item!",arrayEnum:"The '{field} field value '{expected}' does not match any of the allowed values!",boolean:"The '{field}' field must be a boolean!",function:"The '{field}' field must be a function!",date:"The '{field}' field must be a Date!",dateMin:"The '{field}' field must be larger than or equal to {expected}!",dateMax:"The '{field}' field must be less than or equal to {expected}!",forbidden:"The '{field}' field is forbidden!",email:"The '{field}' field must be a valid e-mail!"},b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,g=/^\S+@\S+\.\S+$/,E=/^https?:\/\/\S+/;return d.prototype.validate=function(e,t){return this.compile(t)(e)},d.prototype.compile=function(e){var t=this;if(Array.isArray(e)){if(0==e.length)throw Error("If the schema is an Array, must contain at least one element!");var r=h(e.map(function(e){return t._processRule(e,null,!1)}));return this._checkWrapper(r,!0)}if(null!=e&&"object"==typeof e)return r=h(Object.keys(e).map(function(r){return t._processRule(e[r],r,!1)})),this._checkWrapper(r);throw Error("Invalid schema!")},d.prototype._processRule=function(e,t,r){var n=[];if(Array.isArray(e))return n.push({fn:this.compile(e),type:"_multi",name:t,schema:e,iterate:r}),n;if("string"==typeof e&&(e={type:e}),!this.rules[e.type])throw Error("Invalid '"+e.type+"' type in validator schema!");return n.push({fn:this.rules[e.type],type:e.type,name:t,schema:e,iterate:r}),"object"===e.type&&e.props&&n.push({fn:this.compile(e.props),type:e.type,name:t,schema:e,iterate:r}),"array"===e.type&&e.items&&n.push({fn:this._checkWrapper(this._processRule(e.items,null,!1)),type:e.type,name:t,schema:e,iterate:!0}),n},d.prototype._checkWrapper=function(e,t){var r=this;return function(n,i,a){i=[];for(var o=e.length,l=0;l<o;l++){var u=e[l],s=u.schema;if(u.name)var f=n[u.name],m=(a?a+".":"")+u.name;else f=n,m=a||"";if(void 0!==f&&null!==f||"forbidden"===u.type)if(u.iterate)for(var h=f.length,c=0;c<h;c++){var d=m+"["+c+"]",p=u.fn.call(r,f[c],s,d);!0!==p&&r.handleResult(i,d,p)}else{if(u=u.fn.call(r,f,s,m),t&&!0===u)return!0;!0!==u&&r.handleResult(i,m,u)}else!0!==s.optional&&r.handleResult(i,m,r.makeError("required"))}return 0===i.length||i}},d.prototype.handleResult=function(e,t,r){var n=this;(Array.isArray(r)?r:[r]).forEach(function(r){r.field||(r.field=t),r.message||(r.message=n.resolveMessage(r)),e.push(r)})},d.prototype.makeError=function(e,t,r){return{type:e,expected:t,actual:r}},d.prototype.resolveMessage=function(e){var t=this.messages[e.type];if(null!=t){var r=null!=e.expected?e.expected:"",n=null!=e.actual?e.actual:"";return t.replace(/\{field\}/g,e.field).replace(/\{expected\}/g,r).replace(/\{actual\}/g,n)}},d.prototype.add=function(e,t){this.rules[e]=t},d}var e=e||{};e.scope={},e.ASSUME_ES5=!1,e.ASSUME_NO_NATIVE_MAP=!1,e.ASSUME_NO_NATIVE_SET=!1,e.defineProperty=e.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){e!=Array.prototype&&e!=Object.prototype&&(e[t]=r.value)},e.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e},e.global=e.getGlobal(this),e.SYMBOL_PREFIX="jscomp_symbol_",e.initSymbol=function(){e.initSymbol=function(){},e.global.Symbol||(e.global.Symbol=e.Symbol)},e.Symbol=function(){var t=0;return function(r){return e.SYMBOL_PREFIX+(r||"")+t++}}(),e.initSymbolIterator=function(){e.initSymbol();var t=e.global.Symbol.iterator;t||(t=e.global.Symbol.iterator=e.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&e.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return e.arrayIterator(this)}}),e.initSymbolIterator=function(){}},e.arrayIterator=function(t){var r=0;return e.iteratorPrototype(function(){return r<t.length?{done:!1,value:t[r++]}:{done:!0}})},e.iteratorPrototype=function(t){return e.initSymbolIterator(),t={next:t},t[e.global.Symbol.iterator]=function(){return this},t},e.iteratorFromArray=function(t,r){e.initSymbolIterator(),t instanceof String&&(t+="");var n=0,i={next:function(){if(n<t.length){var e=n++;return{value:r(e,t[e]),done:!1}}return i.next=function(){return{done:!0,value:void 0}},i.next()}};return i[Symbol.iterator]=function(){return i},i},e.polyfill=function(t,r){if(r){var n=e.global;t=t.split(".");for(var i=0;i<t.length-1;i++){var a=t[i];a in n||(n[a]={}),n=n[a]}(r=r(i=n[t=t[t.length-1]]))!=i&&null!=r&&e.defineProperty(n,t,{configurable:!0,writable:!0,value:r})}},e.polyfill("Array.prototype.keys",function(t){return t||function(){return e.iteratorFromArray(this,function(e){return e})}},"es6","es3"),"object"==typeof exports&&"undefined"!=typeof module?module.exports=u():"function"==typeof define&&define.amd?define(u):this.FastestValidator=u(); | ||
"use strict";function u(){function e(e){return"string"!=typeof e?this.makeError("string"):!!E.test(e)||this.makeError("url")}function t(e,t){if("string"!=typeof e)return this.makeError("string");var r=e.length;return!1===t.empty&&0===r?this.makeError("stringEmpty"):null!=t.min&&r<t.min?this.makeError("stringMin",t.min,r):null!=t.max&&r>t.max?this.makeError("stringMax",t.max,r):null!=t.length&&r!==t.length?this.makeError("stringLength",t.length,r):null==t.pattern||t.pattern.test(e)?null!=t.contains&&-1===e.indexOf(t.contains)?this.makeError("stringContains",t.contains):null==t.enum||-1!==t.enum.indexOf(e)||this.makeError("stringEnum",t.enum):this.makeError("stringPattern",t.pattern)}function r(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)||this.makeError("object")}function n(e,t){return!0===t.convert&&"number"!=typeof e&&(e=Number(e)),"number"!=typeof e||isNaN(e)||!isFinite(e)?this.makeError("number"):null!=t.min&&e<t.min?this.makeError("numberMin",t.min,e):null!=t.max&&e>t.max?this.makeError("numberMax",t.max,e):null!=t.equal&&e!==t.equal?this.makeError("numberEqual",t.equal,e):null!=t.notEqual&&e===t.notEqual?this.makeError("numberNotEqual",t.notEqual):!0===t.integer&&0!=e%1?this.makeError("numberInteger",e):!0===t.positive&&0>=e?this.makeError("numberPositive",e):!(!0===t.negative&&0<=e)||this.makeError("numberNegative",e)}function i(e){return"function"==typeof e||this.makeError("function")}function a(e){return null===e||void 0===e||this.makeError("forbidden")}function o(e,t){return"string"!=typeof e?this.makeError("string"):!!("precise"==t.mode?b:g).test(e)||this.makeError("email")}function l(e,t){return!0!==t.convert||e instanceof Date||(e=new Date(e)),e instanceof Date&&!isNaN(e.getTime())||this.makeError("date")}function u(e,t){return t.check.call(this,e,t)}function s(e,t){return!0===t.convert&&"boolean"!=typeof e&&(1===e||0===e||"true"===e||"false"===e||"1"===e||"0"===e||"on"===e||"off"===e)||("boolean"==typeof e||this.makeError("boolean"))}function f(e,t){if(!Array.isArray(e))return this.makeError("array");var r=e.length;if(!1===t.empty&&0===r)return this.makeError("arrayEmpty");if(null!=t.min&&r<t.min)return this.makeError("arrayMin",t.min,r);if(null!=t.max&&r>t.max)return this.makeError("arrayMax",t.max,r);if(null!=t.length&&r!==t.length)return this.makeError("arrayLength",t.length,r);if(null!=t.contains&&-1===e.indexOf(t.contains))return this.makeError("arrayContains",t.contains);if(null!=t.enum)for(r=0;r<e.length;r++)if(-1===t.enum.indexOf(e[r]))return this.makeError("arrayEnum",e[r],t.enum);return!0}function m(){return!0}function h(e,t){t=t||[];for(var r=0;r<e.length;++r)Array.isArray(e[r])?h(e[r],t):t.push(e[r]);return t}function c(e,t){for(var r in t)"object"==typeof t[r]&&null!==t[r]?(e[r]=e[r]||{},c(e[r],t[r])):e[r]=t[r];return e}function d(h){this.opts={messages:y},h&&p(this.opts,h),this.messages=this.opts.messages,this.rules={any:m,array:f,boolean:s,custom:u,date:l,email:o,forbidden:a,function:i,number:n,object:r,string:t,url:e}}var p=c,y={required:"The '{field}' field is required!",string:"The '{field}' field must be a string!",stringEmpty:"The '{field}' field must not be empty!",stringMin:"The '{field}' field length must be larger than or equal to {expected} characters long!",stringMax:"The '{field}' field length must be less than or equal to {expected} characters long!",stringLength:"The '{field}' field length must be {expected} characters long!",stringPattern:"The '{field}' field fails to match the required pattern!",stringContains:"The '{field}' field must contain the '{expected}' text!",stringEnum:"The '{field}' field does not match any of the allowed values!",number:"The '{field}' field must be a number!",numberMin:"The '{field}' field must be larger than or equal to {expected}!",numberMax:"The '{field}' field must be less than or equal to {expected}!",numberEqual:"The '{field}' field must be equal with {expected}!",numberNotEqual:"The '{field}' field can't be equal with {expected}!",numberInteger:"The '{field}' field must be an integer!",numberPositive:"The '{field}' field must be a positive number!",numberNegative:"The '{field}' field must be a negative number!",array:"The '{field}' field must be an array!",arrayEmpty:"The '{field}' field must not be an empty array!",arrayMin:"The '{field}' field must contain at least {expected} items!",arrayMax:"The '{field}' field must contain less than or equal to {expected} items!",arrayLength:"The '{field}' field must contain {expected} items!",arrayContains:"The '{field}' field must contain the '{expected}' item!",arrayEnum:"The '{field} field value '{expected}' does not match any of the allowed values!",boolean:"The '{field}' field must be a boolean!",function:"The '{field}' field must be a function!",date:"The '{field}' field must be a Date!",dateMin:"The '{field}' field must be larger than or equal to {expected}!",dateMax:"The '{field}' field must be less than or equal to {expected}!",forbidden:"The '{field}' field is forbidden!",email:"The '{field}' field must be a valid e-mail!"},b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,g=/^\S+@\S+\.\S+$/,E=/^https?:\/\/\S+/;return d.prototype.validate=function(e,t){return this.compile(t)(e)},d.prototype.compile=function(e){var t=this,r=this;if(Array.isArray(e)){if(0==e.length)throw Error("If the schema is an Array, must contain at least one element!");return this._checkWrapper(h(e.map(function(e){return t._processRule(e,null,!1)})),!0)}if(null==e||"object"!=typeof e)throw Error("Invalid schema!");var n=h(Object.keys(e).map(function(t){return r._processRule(e[t],t,!1)}));return this._checkWrapper(n)},d.prototype._processRule=function(e,t,r){var n=[];if("string"==typeof e&&(e={type:e}),Array.isArray(e))return n.push({fn:this.compile(e),type:"_multi",name:t,schema:e,iterate:r}),n;if(!this.rules[e.type])throw Error("Invalid '"+e.type+"' type in validator schema!");return n.push({fn:this.rules[e.type],type:e.type,name:t,schema:e,iterate:r}),"object"===e.type&&e.props&&n.push({fn:this.compile(e.props),type:e.type,name:t,schema:e,iterate:r}),"array"===e.type&&e.items&&n.push({fn:this._checkWrapper(this._processRule(e.items,null,!1)),type:e.type,name:t,schema:e,iterate:!0}),n},d.prototype._checkWrapper=function(e,t){var r=this;return function(n,i,a){i=[];for(var o=e.length,l=0;l<o;l++){var u=e[l],s=u.schema;if(u.name)var f=n[u.name],m=(a?a+".":"")+u.name;else f=n,m=a||"";if(void 0!==f&&null!==f||"forbidden"===u.type)if(u.iterate)for(var h=f.length,c=0;c<h;c++){var d=m+"["+c+"]",p=u.fn.call(r,f[c],s,d);!0!==p&&r.handleResult(i,d,p)}else{if(u=u.fn.call(r,f,s,m),t&&!0===u)return!0;!0!==u&&r.handleResult(i,m,u)}else!0!==s.optional&&r.handleResult(i,m,r.makeError("required"))}return 0===i.length||i}},d.prototype.handleResult=function(e,t,r){var n=this;(Array.isArray(r)?r:[r]).forEach(function(r){r.field||(r.field=t),r.message||(r.message=n.resolveMessage(r)),e.push(r)})},d.prototype.makeError=function(e,t,r){return{type:e,expected:t,actual:r}},d.prototype.resolveMessage=function(e){var t=this.messages[e.type];if(null!=t){var r=null!=e.expected?e.expected:"",n=null!=e.actual?e.actual:"";return t.replace(/\{field\}/g,e.field).replace(/\{expected\}/g,r).replace(/\{actual\}/g,n)}},d.prototype.add=function(e,t){this.rules[e]=t},d}var e=e||{};e.scope={},e.ASSUME_ES5=!1,e.ASSUME_NO_NATIVE_MAP=!1,e.ASSUME_NO_NATIVE_SET=!1,e.defineProperty=e.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){e!=Array.prototype&&e!=Object.prototype&&(e[t]=r.value)},e.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e},e.global=e.getGlobal(this),e.SYMBOL_PREFIX="jscomp_symbol_",e.initSymbol=function(){e.initSymbol=function(){},e.global.Symbol||(e.global.Symbol=e.Symbol)},e.Symbol=function(){var t=0;return function(r){return e.SYMBOL_PREFIX+(r||"")+t++}}(),e.initSymbolIterator=function(){e.initSymbol();var t=e.global.Symbol.iterator;t||(t=e.global.Symbol.iterator=e.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&e.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return e.arrayIterator(this)}}),e.initSymbolIterator=function(){}},e.arrayIterator=function(t){var r=0;return e.iteratorPrototype(function(){return r<t.length?{done:!1,value:t[r++]}:{done:!0}})},e.iteratorPrototype=function(t){return e.initSymbolIterator(),t={next:t},t[e.global.Symbol.iterator]=function(){return this},t},e.iteratorFromArray=function(t,r){e.initSymbolIterator(),t instanceof String&&(t+="");var n=0,i={next:function(){if(n<t.length){var e=n++;return{value:r(e,t[e]),done:!1}}return i.next=function(){return{done:!0,value:void 0}},i.next()}};return i[Symbol.iterator]=function(){return i},i},e.polyfill=function(t,r){if(r){var n=e.global;t=t.split(".");for(var i=0;i<t.length-1;i++){var a=t[i];a in n||(n[a]={}),n=n[a]}(r=r(i=n[t=t[t.length-1]]))!=i&&null!=r&&e.defineProperty(n,t,{configurable:!0,writable:!0,value:r})}},e.polyfill("Array.prototype.keys",function(t){return t||function(){return e.iteratorFromArray(this,function(e){return e})}},"es6","es3"),"object"==typeof exports&&"undefined"!=typeof module?module.exports=u():"function"==typeof define&&define.amd?define(u):this.FastestValidator=u(); |
@@ -380,2 +380,27 @@ (function (global, factory) { | ||
var PATTERN$1 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i; | ||
var uuid = function checkUUID(value, schema) { | ||
if (typeof value !== "string") | ||
{ return this.makeError("string"); } | ||
value = value.toLowerCase(); | ||
if (!PATTERN$1.test(value)) | ||
{ return this.makeError("uuid"); } | ||
var version = value.charAt(14)|0; | ||
if(schema.version && schema.version !== version) | ||
{ return this.makeError("uuidVersion", schema.version, version); } | ||
switch (version) { | ||
case 1: | ||
case 2: | ||
return true; | ||
case 3: | ||
case 4: | ||
case 5: | ||
return ["8", "9", "a", "b"].indexOf(value.charAt(19)) !== -1 || this.makeError("uuid"); | ||
} | ||
}; | ||
function loadRules() { | ||
@@ -395,3 +420,4 @@ return { | ||
string: string, | ||
url: url | ||
url: url, | ||
uuid: uuid | ||
}; | ||
@@ -398,0 +424,0 @@ } |
@@ -1,1 +0,1 @@ | ||
"use strict";function r(){function e(e){return"string"!=typeof e?this.makeError("string"):!!_.test(e)||this.makeError("url")}function t(e,t){if("string"!=typeof e)return this.makeError("string");var r=e.length;return!1===t.empty&&0===r?this.makeError("stringEmpty"):null!=t.min&&r<t.min?this.makeError("stringMin",t.min,r):null!=t.max&&r>t.max?this.makeError("stringMax",t.max,r):null!=t.length&&r!==t.length?this.makeError("stringLength",t.length,r):null==t.pattern||(r="string"==typeof t.pattern?new RegExp(t.pattern,t.patternFlags):t.pattern).test(e)?null!=t.contains&&-1===e.indexOf(t.contains)?this.makeError("stringContains",t.contains):null!=t.enum&&-1===t.enum.indexOf(e)?this.makeError("stringEnum",t.enum):!0!==t.numeric||S.test(e)?!0!==t.alpha||k.test(e)?!0!==t.alphanum||x.test(e)?!(!0===t.alphadash&&!O.test(e))||this.makeError("stringAlphadash","An alphadash string",e):this.makeError("stringAlphanum","An alphanumeric string",e):this.makeError("stringAlpha","An alphabetic string",e):this.makeError("stringNumeric","A numeric string",e):this.makeError("stringPattern",r)}function r(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return this.makeError("object");if(!0===t.strict&&t.props){t=Object.keys(t.props);var r=[];e=Object.keys(e);for(var n=0;n<e.length;n++)-1===t.indexOf(e[n])&&r.push(e[n]);if(0!==r.length)return this.makeError("objectStrict",void 0,r.join(", "))}return!0}function n(e,t){return!0===t.convert&&"number"!=typeof e&&(e=Number(e)),"number"!=typeof e||isNaN(e)||!isFinite(e)?this.makeError("number"):null!=t.min&&e<t.min?this.makeError("numberMin",t.min,e):null!=t.max&&e>t.max?this.makeError("numberMax",t.max,e):null!=t.equal&&e!==t.equal?this.makeError("numberEqual",t.equal,e):null!=t.notEqual&&e===t.notEqual?this.makeError("numberNotEqual",t.notEqual):!0===t.integer&&0!=e%1?this.makeError("numberInteger",e):!0===t.positive&&0>=e?this.makeError("numberPositive",e):!(!0===t.negative&&0<=e)||this.makeError("numberNegative",e)}function i(e){return"function"==typeof e||this.makeError("function")}function a(e){return null===e||void 0===e||this.makeError("forbidden")}function o(e,t){return null==t.values||-1!==t.values.indexOf(e)||this.makeError("enumValue",t.values,e)}function s(e,t){return"string"!=typeof e?this.makeError("string"):!!("precise"==t.mode?v:E).test(e)||this.makeError("email")}function u(e,t){return!0!==t.convert||e instanceof Date||(e=new Date(e)),e instanceof Date&&!isNaN(e.getTime())||this.makeError("date")}function l(e,t){return t.check.call(this,e,t)}function c(e,t){return!0===t.convert&&"boolean"!=typeof e&&(1===e||0===e||"true"===e||"false"===e||"1"===e||"0"===e||"on"===e||"off"===e)||("boolean"==typeof e||this.makeError("boolean"))}function f(e,t){if(!Array.isArray(e))return this.makeError("array");var r=e.length;if(!1===t.empty&&0===r)return this.makeError("arrayEmpty");if(null!=t.min&&r<t.min)return this.makeError("arrayMin",t.min,r);if(null!=t.max&&r>t.max)return this.makeError("arrayMax",t.max,r);if(null!=t.length&&r!==t.length)return this.makeError("arrayLength",t.length,r);if(null!=t.contains&&-1===e.indexOf(t.contains))return this.makeError("arrayContains",t.contains);if(null!=t.enum)for(r=0;r<e.length;r++)if(-1===t.enum.indexOf(e[r]))return this.makeError("arrayEnum",e[r],t.enum);return!0}function h(){return!0}function p(e,t){t=t||[];for(var r=0;r<e.length;++r)Array.isArray(e[r])?p(e[r],t):t.push(e[r]);return t}function m(e,t){for(var r in t)"object"==typeof t[r]&&null!==t[r]?(e[r]=e[r]||{},m(e[r],t[r])):e[r]=t[r];return e}function d(e){return e.replace(T,function(e){switch(e){case'"':case"'":case"\\":return"\\"+e;case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029"}})}function y(p){this.opts={messages:b({},g)},p&&b(this.opts,p),this.messages=this.opts.messages,this.messageKeys=Object.keys(this.messages),this.rules={any:h,array:f,boolean:c,custom:l,date:u,email:s,enum:o,forbidden:a,function:i,number:n,object:r,string:t,url:e},this.cache=new Map}var b=m,g={required:"The '{field}' field is required!",string:"The '{field}' field must be a string!",stringEmpty:"The '{field}' field must not be empty!",stringMin:"The '{field}' field length must be greater than or equal to {expected} characters long!",stringMax:"The '{field}' field length must be less than or equal to {expected} characters long!",stringLength:"The '{field}' field length must be {expected} characters long!",stringPattern:"The '{field}' field fails to match the required pattern!",stringContains:"The '{field}' field must contain the '{expected}' text!",stringEnum:"The '{field}' field does not match any of the allowed values!",stringNumeric:"The '{field}' field must be a numeric string",stringAlpha:"The '{field}' field must be an alphabetic string",stringAlphanum:"The '{field}' field must be an alphanumeric string",stringAlphadash:"The '{field}' field must be an alphadash string",number:"The '{field}' field must be a number!",numberMin:"The '{field}' field must be greater than or equal to {expected}!",numberMax:"The '{field}' field must be less than or equal to {expected}!",numberEqual:"The '{field}' field must be equal with {expected}!",numberNotEqual:"The '{field}' field can't be equal with {expected}!",numberInteger:"The '{field}' field must be an integer!",numberPositive:"The '{field}' field must be a positive number!",numberNegative:"The '{field}' field must be a negative number!",array:"The '{field}' field must be an array!",arrayEmpty:"The '{field}' field must not be an empty array!",arrayMin:"The '{field}' field must contain at least {expected} items!",arrayMax:"The '{field}' field must contain less than or equal to {expected} items!",arrayLength:"The '{field}' field must contain {expected} items!",arrayContains:"The '{field}' field must contain the '{expected}' item!",arrayEnum:"The '{field} field value '{expected}' does not match any of the allowed values!",boolean:"The '{field}' field must be a boolean!",function:"The '{field}' field must be a function!",date:"The '{field}' field must be a Date!",dateMin:"The '{field}' field must be greater than or equal to {expected}!",dateMax:"The '{field}' field must be less than or equal to {expected}!",forbidden:"The '{field}' field is forbidden!",email:"The '{field}' field must be a valid e-mail!",url:"The '{field}' field must be a valid URL!",enumValue:"The '{field} field value '{expected}' does not match any of the allowed values!",object:"The '{field}' must be an Object!",objectStrict:"The object '{field}' contains invalid keys: '{actual}'!",uuid:"The {field} field must be a valid UUID",uuidVersion:"The {field} field must be a valid version provided"},v=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,E=/^\S+@\S+\.\S+$/,S=/^-?[0-9]\d*(\.\d+)?$/,k=/^[a-zA-Z]+$/,x=/^[a-zA-Z0-9]+$/,O=/^[a-zA-Z0-9_-]+$/,_=/^https?:\/\/\S+/,A=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/,T=/["'\\\n\r\u2028\u2029]/g;return y.prototype.validate=function(e,t){return this.compile(t)(e)},y.prototype.compile=function(e){var t=this;if(Array.isArray(e)){if(0==e.length)throw Error("If the schema is an Array, must contain at least one element!");var r=this.compileSchemaType(e);return this.cache.clear(),function(e,n,i){return t.checkSchemaType(e,r,n,i||null)}}var n=this.compileSchemaObject(e);return this.cache.clear(),function(e,r,i){return t.checkSchemaObject(e,n,r,i||null)}},y.prototype.compileSchemaObject=function(e){var t=this;if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("Invalid schema!");var r=e.$$strict;delete e.$$strict;var n=this.cache.get(e);if(n)return n.cycle=!0,n;n={cycle:!1,properties:null,compiledObjectFunction:null,objectStack:[]},this.cache.set(e,n),n.properties=Object.keys(e).map(function(r){return{name:r,compiledType:t.compileSchemaType(e[r])}});var i=[];i.push("let res;"),i.push("let propertyPath;"),i.push("const errors = [];"),!0===r&&i.push("const givenProps = new Map(Object.keys(value).map(key => [key, true]));");for(var a=0;a<n.properties.length;a++){var o=n.properties[a],s=d(o.name),u=A.test(s)?"value."+s:'value["'+s+'"]';i.push('propertyPath = (path !== undefined ? path + ".'+s+'" : "'+s+'");'),Array.isArray(o.compiledType)?i.push("res = this.checkSchemaType("+u+", properties["+a+"].compiledType, propertyPath, value);"):i.push("res = this.checkSchemaRule("+u+", properties["+a+"].compiledType, propertyPath, value);"),i.push("if (res !== true) {"),i.push("\tthis.handleResult(errors, propertyPath, res, properties["+a+"].compiledType.messages);"),i.push("}"),!0===r&&i.push('givenProps.delete("'+s+'");')}return!0===r&&(i.push("if (givenProps.size !== 0) {"),i.push("\tthis.handleResult(errors, path || 'rootObject', this.makeError('objectStrict', undefined, [...givenProps.keys()].join(', ')), this.messages);"),i.push("}")),i.push("return errors.length === 0 ? true : errors;"),n.compiledObjectFunction=new Function("value","properties","path","parent",i.join("\n")),n},y.prototype.compileSchemaType=function(e){var t=this;return Array.isArray(e)?(e=p(e.map(function(e){return t.compileSchemaType(e)})),1==e.length?e[0]:e):this.compileSchemaRule(e)},y.prototype.compileMessages=function(e){var t=this;return e.messages?this.messageKeys.reduce(function(r,n){return r[n]=e.messages[n]||t.messages[n],r},{}):this.messages},y.prototype.compileSchemaRule=function(e){"string"==typeof e&&(e={type:e});var t=this.rules[e.type];if(!t)throw Error("Invalid '"+e.type+"' type in validator schema!");var r=this.compileMessages(e),n=null,i=null;return"object"===e.type&&e.props?(n=this.compileSchemaObject(e.props),i=this.checkSchemaObject):"array"===e.type&&e.items&&(n=this.compileSchemaType(e.items),i=this.checkSchemaArray),{messages:r,schemaRule:e,ruleFunction:t,dataFunction:i,dataParameter:n}},y.prototype.checkSchemaObject=function(e,t,r,n){return t.cycle?-1!==t.objectStack.indexOf(e)||(t.objectStack.push(e),e=this.checkSchemaObjectInner(e,t,r,n),t.objectStack.pop(),e):this.checkSchemaObjectInner(e,t,r,n)},y.prototype.checkSchemaObjectInner=function(e,t,r,n){return t.compiledObjectFunction.call(this,e,t.properties,r,n)},y.prototype.checkSchemaType=function(e,t,r,n){if(Array.isArray(t)){for(var i=[],a=t.length,o=0;o<a;o++){var s=this.checkSchemaRule(e,t[o],r,n);if(!0===s)return!0;this.handleResult(i,r,s,t.messages)}return i}return this.checkSchemaRule(e,t,r,n)},y.prototype.checkSchemaArray=function(e,t,r,n){for(var i=[],a=e.length,o=0;o<a;o++){var s=(void 0!==r?r:"")+"["+o+"]",u=this.checkSchemaType(e[o],t,s,e,n);!0!==u&&this.handleResult(i,s,u,t.messages)}return 0===i.length||i},y.prototype.checkSchemaRule=function(e,t,r,n){var i=t.schemaRule;return void 0===e||null===e?"forbidden"===i.type||!0===i.optional||(e=[],this.handleResult(e,r,this.makeError("required"),t.messages),e):(i=t.ruleFunction.call(this,e,i,r,n),!0!==i?(e=[],this.handleResult(e,r,i,t.messages),e):null===t.dataFunction||t.dataFunction.call(this,e,t.dataParameter,r,n))},y.prototype.handleResult=function(e,t,r,n){var i=this;(Array.isArray(r)?r:[r]).forEach(function(r){r.field||(r.field=t),r.message||(r.message=i.resolveMessage(r,n[r.type])),e.push(r)})},y.prototype.makeError=function(e,t,r){return{type:e,expected:t,actual:r}},y.prototype.resolveMessage=function(e,t){if(void 0===t&&(t=null),null!=t){var r=null!=e.expected?e.expected:"",n=null!=e.actual?e.actual:"";return t.replace(/\{field\}/g,e.field).replace(/\{expected\}/g,r).replace(/\{actual\}/g,n)}},y.prototype.add=function(e,t){this.rules[e]=t},y}var f=f||{};f.scope={},f.ASSUME_ES5=!1,f.ASSUME_NO_NATIVE_MAP=!1,f.ASSUME_NO_NATIVE_SET=!1,f.defineProperty=f.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){e!=Array.prototype&&e!=Object.prototype&&(e[t]=r.value)},f.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e},f.global=f.getGlobal(this),f.SYMBOL_PREFIX="jscomp_symbol_",f.initSymbol=function(){f.initSymbol=function(){},f.global.Symbol||(f.global.Symbol=f.Symbol)},f.Symbol=function(){var e=0;return function(t){return f.SYMBOL_PREFIX+(t||"")+e++}}(),f.initSymbolIterator=function(){f.initSymbol();var e=f.global.Symbol.iterator;e||(e=f.global.Symbol.iterator=f.global.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&f.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return f.arrayIterator(this)}}),f.initSymbolIterator=function(){}},f.arrayIterator=function(e){var t=0;return f.iteratorPrototype(function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}})},f.iteratorPrototype=function(e){return f.initSymbolIterator(),e={next:e},e[f.global.Symbol.iterator]=function(){return this},e},f.iteratorFromArray=function(e,t){f.initSymbolIterator(),e instanceof String&&(e+="");var r=0,n={next:function(){if(r<e.length){var i=r++;return{value:t(i,e[i]),done:!1}}return n.next=function(){return{done:!0,value:void 0}},n.next()}};return n[Symbol.iterator]=function(){return n},n},f.polyfill=function(e,t){if(t){var r=f.global;e=e.split(".");for(var n=0;n<e.length-1;n++){var i=e[n];i in r||(r[i]={}),r=r[i]}(t=t(n=r[e=e[e.length-1]]))!=n&&null!=t&&f.defineProperty(r,e,{configurable:!0,writable:!0,value:t})}},f.polyfill("Array.prototype.keys",function(e){return e||function(){return f.iteratorFromArray(this,function(e){return e})}},"es6","es3"),f.checkEs6ConformanceViaProxy=function(){try{var e={},t=Object.create(new f.global.Proxy(e,{get:function(r,n,i){return r==e&&"q"==n&&i==t}}));return!0===t.q}catch(e){return!1}},f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1,f.ES6_CONFORMANCE=f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&f.checkEs6ConformanceViaProxy(),f.makeIterator=function(e){f.initSymbolIterator();var t=e[Symbol.iterator];return t?t.call(e):f.arrayIterator(e)},f.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.polyfill("WeakMap",function(e){function t(e){if(this.id_=(a+=Math.random()+1).toString(),e){f.initSymbol(),f.initSymbolIterator(),e=f.makeIterator(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function r(e){f.owns(e,i)||f.defineProperty(e,i,{value:{}})}function n(e){var t=Object[e];t&&(Object[e]=function(e){return r(e),t(e)})}if(f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(e&&f.ES6_CONFORMANCE)return e}else if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),r=Object.seal({}),n=new e([[t,2],[r,3]]);return 2==n.get(t)&&3==n.get(r)&&(n.delete(t),n.set(r,4),!n.has(t)&&4==n.get(r))}catch(e){return!1}}())return e;var i="$jscomp_hidden_"+Math.random();n("freeze"),n("preventExtensions"),n("seal");var a=0;return t.prototype.set=function(e,t){if(r(e),!f.owns(e,i))throw Error("WeakMap key fail: "+e);return e[i][this.id_]=t,this},t.prototype.get=function(e){return f.owns(e,i)?e[i][this.id_]:void 0},t.prototype.has=function(e){return f.owns(e,i)&&f.owns(e[i],this.id_)},t.prototype.delete=function(e){return!(!f.owns(e,i)||!f.owns(e[i],this.id_))&&delete e[i][this.id_]},t},"es6","es3"),f.MapEntry=function(){},f.polyfill("Map",function(e){function t(){var e={};return e.previous=e.next=e.head=e}function r(e,t){var r=e.head_;return f.iteratorPrototype(function(){if(r){for(;r.head!=e.head_;)r=r.previous;for(;r.next!=r.head;)return r=r.next,{done:!1,value:t(r)};r=null}return{done:!0,value:void 0}})}function n(e,t){var r=t&&typeof t;"object"==r||"function"==r?a.has(t)?r=a.get(t):(r=""+ ++o,a.set(t,r)):r="p_"+t;var n=e.data_[r];if(n&&f.owns(e.data_,r))for(e=0;e<n.length;e++){var i=n[e];if(t!==t&&i.key!==i.key||t===i.key)return{id:r,list:n,index:e,entry:i}}return{id:r,list:n,index:-1,entry:void 0}}function i(e){if(this.data_={},this.head_=t(),this.size=0,e){e=f.makeIterator(e);for(var r;!(r=e.next()).done;)r=r.value,this.set(r[0],r[1])}}if(f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(e&&f.ES6_CONFORMANCE)return e}else if(function(){if(f.ASSUME_NO_NATIVE_MAP||!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),r=new e(f.makeIterator([[t,"s"]]));if("s"!=r.get(t)||1!=r.size||r.get({x:4})||r.set({x:4},"t")!=r||2!=r.size)return!1;var n=r.entries(),i=n.next();return!i.done&&i.value[0]==t&&"s"==i.value[1]&&!((i=n.next()).done||4!=i.value[0].x||"t"!=i.value[1]||!n.next().done)}catch(e){return!1}}())return e;f.initSymbol(),f.initSymbolIterator();var a=new WeakMap;i.prototype.set=function(e,t){var r=n(this,e);return r.list||(r.list=this.data_[r.id]=[]),r.entry?r.entry.value=t:(r.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:e,value:t},r.list.push(r.entry),this.head_.previous.next=r.entry,this.head_.previous=r.entry,this.size++),this},i.prototype.delete=function(e){return!(!(e=n(this,e)).entry||!e.list)&&(e.list.splice(e.index,1),e.list.length||delete this.data_[e.id],e.entry.previous.next=e.entry.next,e.entry.next.previous=e.entry.previous,e.entry.head=null,this.size--,!0)},i.prototype.clear=function(){this.data_={},this.head_=this.head_.previous=t(),this.size=0},i.prototype.has=function(e){return!!n(this,e).entry},i.prototype.get=function(e){return(e=n(this,e).entry)&&e.value},i.prototype.entries=function(){return r(this,function(e){return[e.key,e.value]})},i.prototype.keys=function(){return r(this,function(e){return e.key})},i.prototype.values=function(){return r(this,function(e){return e.value})},i.prototype.forEach=function(e,t){for(var r,n=this.entries();!(r=n.next()).done;)r=r.value,e.call(t,r[1],r[0],this)},i.prototype[Symbol.iterator]=i.prototype.entries;var o=0;return i},"es6","es3"),"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):this.FastestValidator=r(); | ||
"use strict";function r(){function e(e,t){if("string"!=typeof e)return this.makeError("string");if(e=e.toLowerCase(),!T.test(e))return this.makeError("uuid");var r=0|e.charAt(14);if(t.version&&t.version!==r)return this.makeError("uuidVersion",t.version,r);switch(r){case 1:case 2:return!0;case 3:case 4:case 5:return-1!==["8","9","a","b"].indexOf(e.charAt(19))||this.makeError("uuid")}}function t(e){return"string"!=typeof e?this.makeError("string"):!!A.test(e)||this.makeError("url")}function r(e,t){if("string"!=typeof e)return this.makeError("string");var r=e.length;return!1===t.empty&&0===r?this.makeError("stringEmpty"):null!=t.min&&r<t.min?this.makeError("stringMin",t.min,r):null!=t.max&&r>t.max?this.makeError("stringMax",t.max,r):null!=t.length&&r!==t.length?this.makeError("stringLength",t.length,r):null==t.pattern||(r="string"==typeof t.pattern?new RegExp(t.pattern,t.patternFlags):t.pattern).test(e)?null!=t.contains&&-1===e.indexOf(t.contains)?this.makeError("stringContains",t.contains):null!=t.enum&&-1===t.enum.indexOf(e)?this.makeError("stringEnum",t.enum):!0!==t.numeric||S.test(e)?!0!==t.alpha||x.test(e)?!0!==t.alphanum||O.test(e)?!(!0===t.alphadash&&!_.test(e))||this.makeError("stringAlphadash","An alphadash string",e):this.makeError("stringAlphanum","An alphanumeric string",e):this.makeError("stringAlpha","An alphabetic string",e):this.makeError("stringNumeric","A numeric string",e):this.makeError("stringPattern",r)}function n(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return this.makeError("object");if(!0===t.strict&&t.props){t=Object.keys(t.props);var r=[];e=Object.keys(e);for(var n=0;n<e.length;n++)-1===t.indexOf(e[n])&&r.push(e[n]);if(0!==r.length)return this.makeError("objectStrict",void 0,r.join(", "))}return!0}function i(e,t){return!0===t.convert&&"number"!=typeof e&&(e=Number(e)),"number"!=typeof e||isNaN(e)||!isFinite(e)?this.makeError("number"):null!=t.min&&e<t.min?this.makeError("numberMin",t.min,e):null!=t.max&&e>t.max?this.makeError("numberMax",t.max,e):null!=t.equal&&e!==t.equal?this.makeError("numberEqual",t.equal,e):null!=t.notEqual&&e===t.notEqual?this.makeError("numberNotEqual",t.notEqual):!0===t.integer&&0!=e%1?this.makeError("numberInteger",e):!0===t.positive&&0>=e?this.makeError("numberPositive",e):!(!0===t.negative&&0<=e)||this.makeError("numberNegative",e)}function a(e){return"function"==typeof e||this.makeError("function")}function o(e){return null===e||void 0===e||this.makeError("forbidden")}function s(e,t){return null==t.values||-1!==t.values.indexOf(e)||this.makeError("enumValue",t.values,e)}function u(e,t){return"string"!=typeof e?this.makeError("string"):!!("precise"==t.mode?E:k).test(e)||this.makeError("email")}function l(e,t){return!0!==t.convert||e instanceof Date||(e=new Date(e)),e instanceof Date&&!isNaN(e.getTime())||this.makeError("date")}function f(e,t){return t.check.call(this,e,t)}function c(e,t){return!0===t.convert&&"boolean"!=typeof e&&(1===e||0===e||"true"===e||"false"===e||"1"===e||"0"===e||"on"===e||"off"===e)||("boolean"==typeof e||this.makeError("boolean"))}function h(e,t){if(!Array.isArray(e))return this.makeError("array");var r=e.length;if(!1===t.empty&&0===r)return this.makeError("arrayEmpty");if(null!=t.min&&r<t.min)return this.makeError("arrayMin",t.min,r);if(null!=t.max&&r>t.max)return this.makeError("arrayMax",t.max,r);if(null!=t.length&&r!==t.length)return this.makeError("arrayLength",t.length,r);if(null!=t.contains&&-1===e.indexOf(t.contains))return this.makeError("arrayContains",t.contains);if(null!=t.enum)for(r=0;r<e.length;r++)if(-1===t.enum.indexOf(e[r]))return this.makeError("arrayEnum",e[r],t.enum);return!0}function p(){return!0}function m(e,t){t=t||[];for(var r=0;r<e.length;++r)Array.isArray(e[r])?m(e[r],t):t.push(e[r]);return t}function d(e,t){for(var r in t)"object"==typeof t[r]&&null!==t[r]?(e[r]=e[r]||{},d(e[r],t[r])):e[r]=t[r];return e}function y(e){return e.replace(M,function(e){switch(e){case'"':case"'":case"\\":return"\\"+e;case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029"}})}function b(m){this.opts={messages:g({},v)},m&&g(this.opts,m),this.messages=this.opts.messages,this.messageKeys=Object.keys(this.messages),this.rules={any:p,array:h,boolean:c,custom:f,date:l,email:u,enum:s,forbidden:o,function:a,number:i,object:n,string:r,url:t,uuid:e},this.cache=new Map}var g=d,v={required:"The '{field}' field is required!",string:"The '{field}' field must be a string!",stringEmpty:"The '{field}' field must not be empty!",stringMin:"The '{field}' field length must be greater than or equal to {expected} characters long!",stringMax:"The '{field}' field length must be less than or equal to {expected} characters long!",stringLength:"The '{field}' field length must be {expected} characters long!",stringPattern:"The '{field}' field fails to match the required pattern!",stringContains:"The '{field}' field must contain the '{expected}' text!",stringEnum:"The '{field}' field does not match any of the allowed values!",stringNumeric:"The '{field}' field must be a numeric string",stringAlpha:"The '{field}' field must be an alphabetic string",stringAlphanum:"The '{field}' field must be an alphanumeric string",stringAlphadash:"The '{field}' field must be an alphadash string",number:"The '{field}' field must be a number!",numberMin:"The '{field}' field must be greater than or equal to {expected}!",numberMax:"The '{field}' field must be less than or equal to {expected}!",numberEqual:"The '{field}' field must be equal with {expected}!",numberNotEqual:"The '{field}' field can't be equal with {expected}!",numberInteger:"The '{field}' field must be an integer!",numberPositive:"The '{field}' field must be a positive number!",numberNegative:"The '{field}' field must be a negative number!",array:"The '{field}' field must be an array!",arrayEmpty:"The '{field}' field must not be an empty array!",arrayMin:"The '{field}' field must contain at least {expected} items!",arrayMax:"The '{field}' field must contain less than or equal to {expected} items!",arrayLength:"The '{field}' field must contain {expected} items!",arrayContains:"The '{field}' field must contain the '{expected}' item!",arrayEnum:"The '{field} field value '{expected}' does not match any of the allowed values!",boolean:"The '{field}' field must be a boolean!",function:"The '{field}' field must be a function!",date:"The '{field}' field must be a Date!",dateMin:"The '{field}' field must be greater than or equal to {expected}!",dateMax:"The '{field}' field must be less than or equal to {expected}!",forbidden:"The '{field}' field is forbidden!",email:"The '{field}' field must be a valid e-mail!",url:"The '{field}' field must be a valid URL!",enumValue:"The '{field} field value '{expected}' does not match any of the allowed values!",object:"The '{field}' must be an Object!",objectStrict:"The object '{field}' contains invalid keys: '{actual}'!",uuid:"The {field} field must be a valid UUID",uuidVersion:"The {field} field must be a valid version provided"},E=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,k=/^\S+@\S+\.\S+$/,S=/^-?[0-9]\d*(\.\d+)?$/,x=/^[a-zA-Z]+$/,O=/^[a-zA-Z0-9]+$/,_=/^[a-zA-Z0-9_-]+$/,A=/^https?:\/\/\S+/,T=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i,j=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/,M=/["'\\\n\r\u2028\u2029]/g;return b.prototype.validate=function(e,t){return this.compile(t)(e)},b.prototype.compile=function(e){var t=this;if(Array.isArray(e)){if(0==e.length)throw Error("If the schema is an Array, must contain at least one element!");var r=this.compileSchemaType(e);return this.cache.clear(),function(e,n,i){return t.checkSchemaType(e,r,n,i||null)}}var n=this.compileSchemaObject(e);return this.cache.clear(),function(e,r,i){return t.checkSchemaObject(e,n,r,i||null)}},b.prototype.compileSchemaObject=function(e){var t=this;if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("Invalid schema!");var r=e.$$strict;delete e.$$strict;var n=this.cache.get(e);if(n)return n.cycle=!0,n;n={cycle:!1,properties:null,compiledObjectFunction:null,objectStack:[]},this.cache.set(e,n),n.properties=Object.keys(e).map(function(r){return{name:r,compiledType:t.compileSchemaType(e[r])}});var i=[];i.push("let res;"),i.push("let propertyPath;"),i.push("const errors = [];"),!0===r&&i.push("const givenProps = new Map(Object.keys(value).map(key => [key, true]));");for(var a=0;a<n.properties.length;a++){var o=n.properties[a],s=y(o.name),u=j.test(s)?"value."+s:'value["'+s+'"]';i.push('propertyPath = (path !== undefined ? path + ".'+s+'" : "'+s+'");'),Array.isArray(o.compiledType)?i.push("res = this.checkSchemaType("+u+", properties["+a+"].compiledType, propertyPath, value);"):i.push("res = this.checkSchemaRule("+u+", properties["+a+"].compiledType, propertyPath, value);"),i.push("if (res !== true) {"),i.push("\tthis.handleResult(errors, propertyPath, res, properties["+a+"].compiledType.messages);"),i.push("}"),!0===r&&i.push('givenProps.delete("'+s+'");')}return!0===r&&(i.push("if (givenProps.size !== 0) {"),i.push("\tthis.handleResult(errors, path || 'rootObject', this.makeError('objectStrict', undefined, [...givenProps.keys()].join(', ')), this.messages);"),i.push("}")),i.push("return errors.length === 0 ? true : errors;"),n.compiledObjectFunction=new Function("value","properties","path","parent",i.join("\n")),n},b.prototype.compileSchemaType=function(e){var t=this;return Array.isArray(e)?(e=m(e.map(function(e){return t.compileSchemaType(e)})),1==e.length?e[0]:e):this.compileSchemaRule(e)},b.prototype.compileMessages=function(e){var t=this;return e.messages?this.messageKeys.reduce(function(r,n){return r[n]=e.messages[n]||t.messages[n],r},{}):this.messages},b.prototype.compileSchemaRule=function(e){"string"==typeof e&&(e={type:e});var t=this.rules[e.type];if(!t)throw Error("Invalid '"+e.type+"' type in validator schema!");var r=this.compileMessages(e),n=null,i=null;return"object"===e.type&&e.props?(n=this.compileSchemaObject(e.props),i=this.checkSchemaObject):"array"===e.type&&e.items&&(n=this.compileSchemaType(e.items),i=this.checkSchemaArray),{messages:r,schemaRule:e,ruleFunction:t,dataFunction:i,dataParameter:n}},b.prototype.checkSchemaObject=function(e,t,r,n){return t.cycle?-1!==t.objectStack.indexOf(e)||(t.objectStack.push(e),e=this.checkSchemaObjectInner(e,t,r,n),t.objectStack.pop(),e):this.checkSchemaObjectInner(e,t,r,n)},b.prototype.checkSchemaObjectInner=function(e,t,r,n){return t.compiledObjectFunction.call(this,e,t.properties,r,n)},b.prototype.checkSchemaType=function(e,t,r,n){if(Array.isArray(t)){for(var i=[],a=t.length,o=0;o<a;o++){var s=this.checkSchemaRule(e,t[o],r,n);if(!0===s)return!0;this.handleResult(i,r,s,t.messages)}return i}return this.checkSchemaRule(e,t,r,n)},b.prototype.checkSchemaArray=function(e,t,r,n){for(var i=[],a=e.length,o=0;o<a;o++){var s=(void 0!==r?r:"")+"["+o+"]",u=this.checkSchemaType(e[o],t,s,e,n);!0!==u&&this.handleResult(i,s,u,t.messages)}return 0===i.length||i},b.prototype.checkSchemaRule=function(e,t,r,n){var i=t.schemaRule;return void 0===e||null===e?"forbidden"===i.type||!0===i.optional||(e=[],this.handleResult(e,r,this.makeError("required"),t.messages),e):(i=t.ruleFunction.call(this,e,i,r,n),!0!==i?(e=[],this.handleResult(e,r,i,t.messages),e):null===t.dataFunction||t.dataFunction.call(this,e,t.dataParameter,r,n))},b.prototype.handleResult=function(e,t,r,n){var i=this;(Array.isArray(r)?r:[r]).forEach(function(r){r.field||(r.field=t),r.message||(r.message=i.resolveMessage(r,n[r.type])),e.push(r)})},b.prototype.makeError=function(e,t,r){return{type:e,expected:t,actual:r}},b.prototype.resolveMessage=function(e,t){if(void 0===t&&(t=null),null!=t){var r=null!=e.expected?e.expected:"",n=null!=e.actual?e.actual:"";return t.replace(/\{field\}/g,e.field).replace(/\{expected\}/g,r).replace(/\{actual\}/g,n)}},b.prototype.add=function(e,t){this.rules[e]=t},b}var f=f||{};f.scope={},f.ASSUME_ES5=!1,f.ASSUME_NO_NATIVE_MAP=!1,f.ASSUME_NO_NATIVE_SET=!1,f.defineProperty=f.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){e!=Array.prototype&&e!=Object.prototype&&(e[t]=r.value)},f.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e},f.global=f.getGlobal(this),f.SYMBOL_PREFIX="jscomp_symbol_",f.initSymbol=function(){f.initSymbol=function(){},f.global.Symbol||(f.global.Symbol=f.Symbol)},f.Symbol=function(){var e=0;return function(t){return f.SYMBOL_PREFIX+(t||"")+e++}}(),f.initSymbolIterator=function(){f.initSymbol();var e=f.global.Symbol.iterator;e||(e=f.global.Symbol.iterator=f.global.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&f.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return f.arrayIterator(this)}}),f.initSymbolIterator=function(){}},f.arrayIterator=function(e){var t=0;return f.iteratorPrototype(function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}})},f.iteratorPrototype=function(e){return f.initSymbolIterator(),e={next:e},e[f.global.Symbol.iterator]=function(){return this},e},f.iteratorFromArray=function(e,t){f.initSymbolIterator(),e instanceof String&&(e+="");var r=0,n={next:function(){if(r<e.length){var i=r++;return{value:t(i,e[i]),done:!1}}return n.next=function(){return{done:!0,value:void 0}},n.next()}};return n[Symbol.iterator]=function(){return n},n},f.polyfill=function(e,t){if(t){var r=f.global;e=e.split(".");for(var n=0;n<e.length-1;n++){var i=e[n];i in r||(r[i]={}),r=r[i]}(t=t(n=r[e=e[e.length-1]]))!=n&&null!=t&&f.defineProperty(r,e,{configurable:!0,writable:!0,value:t})}},f.polyfill("Array.prototype.keys",function(e){return e||function(){return f.iteratorFromArray(this,function(e){return e})}},"es6","es3"),f.checkEs6ConformanceViaProxy=function(){try{var e={},t=Object.create(new f.global.Proxy(e,{get:function(r,n,i){return r==e&&"q"==n&&i==t}}));return!0===t.q}catch(e){return!1}},f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1,f.ES6_CONFORMANCE=f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&f.checkEs6ConformanceViaProxy(),f.makeIterator=function(e){f.initSymbolIterator();var t=e[Symbol.iterator];return t?t.call(e):f.arrayIterator(e)},f.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.polyfill("WeakMap",function(e){function t(e){if(this.id_=(a+=Math.random()+1).toString(),e){f.initSymbol(),f.initSymbolIterator(),e=f.makeIterator(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function r(e){f.owns(e,i)||f.defineProperty(e,i,{value:{}})}function n(e){var t=Object[e];t&&(Object[e]=function(e){return r(e),t(e)})}if(f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(e&&f.ES6_CONFORMANCE)return e}else if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),r=Object.seal({}),n=new e([[t,2],[r,3]]);return 2==n.get(t)&&3==n.get(r)&&(n.delete(t),n.set(r,4),!n.has(t)&&4==n.get(r))}catch(e){return!1}}())return e;var i="$jscomp_hidden_"+Math.random();n("freeze"),n("preventExtensions"),n("seal");var a=0;return t.prototype.set=function(e,t){if(r(e),!f.owns(e,i))throw Error("WeakMap key fail: "+e);return e[i][this.id_]=t,this},t.prototype.get=function(e){return f.owns(e,i)?e[i][this.id_]:void 0},t.prototype.has=function(e){return f.owns(e,i)&&f.owns(e[i],this.id_)},t.prototype.delete=function(e){return!(!f.owns(e,i)||!f.owns(e[i],this.id_))&&delete e[i][this.id_]},t},"es6","es3"),f.MapEntry=function(){},f.polyfill("Map",function(e){function t(){var e={};return e.previous=e.next=e.head=e}function r(e,t){var r=e.head_;return f.iteratorPrototype(function(){if(r){for(;r.head!=e.head_;)r=r.previous;for(;r.next!=r.head;)return r=r.next,{done:!1,value:t(r)};r=null}return{done:!0,value:void 0}})}function n(e,t){var r=t&&typeof t;"object"==r||"function"==r?a.has(t)?r=a.get(t):(r=""+ ++o,a.set(t,r)):r="p_"+t;var n=e.data_[r];if(n&&f.owns(e.data_,r))for(e=0;e<n.length;e++){var i=n[e];if(t!==t&&i.key!==i.key||t===i.key)return{id:r,list:n,index:e,entry:i}}return{id:r,list:n,index:-1,entry:void 0}}function i(e){if(this.data_={},this.head_=t(),this.size=0,e){e=f.makeIterator(e);for(var r;!(r=e.next()).done;)r=r.value,this.set(r[0],r[1])}}if(f.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(e&&f.ES6_CONFORMANCE)return e}else if(function(){if(f.ASSUME_NO_NATIVE_MAP||!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),r=new e(f.makeIterator([[t,"s"]]));if("s"!=r.get(t)||1!=r.size||r.get({x:4})||r.set({x:4},"t")!=r||2!=r.size)return!1;var n=r.entries(),i=n.next();return!i.done&&i.value[0]==t&&"s"==i.value[1]&&!((i=n.next()).done||4!=i.value[0].x||"t"!=i.value[1]||!n.next().done)}catch(e){return!1}}())return e;f.initSymbol(),f.initSymbolIterator();var a=new WeakMap;i.prototype.set=function(e,t){var r=n(this,e);return r.list||(r.list=this.data_[r.id]=[]),r.entry?r.entry.value=t:(r.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:e,value:t},r.list.push(r.entry),this.head_.previous.next=r.entry,this.head_.previous=r.entry,this.size++),this},i.prototype.delete=function(e){return!(!(e=n(this,e)).entry||!e.list)&&(e.list.splice(e.index,1),e.list.length||delete this.data_[e.id],e.entry.previous.next=e.entry.next,e.entry.next.previous=e.entry.previous,e.entry.head=null,this.size--,!0)},i.prototype.clear=function(){this.data_={},this.head_=this.head_.previous=t(),this.size=0},i.prototype.has=function(e){return!!n(this,e).entry},i.prototype.get=function(e){return(e=n(this,e).entry)&&e.value},i.prototype.entries=function(){return r(this,function(e){return[e.key,e.value]})},i.prototype.keys=function(){return r(this,function(e){return e.key})},i.prototype.values=function(){return r(this,function(e){return e.value})},i.prototype.forEach=function(e,t){for(var r,n=this.entries();!(r=n.next()).done;)r=r.value,e.call(t,r[1],r[0],this)},i.prototype[Symbol.iterator]=i.prototype.entries;var o=0;return i},"es6","es3"),"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):this.FastestValidator=r(); |
@@ -25,3 +25,3 @@ /** type declaration for fastest-validator */ | ||
props?: ValidationSchema; | ||
check?: (value: any, ValidationSchema) => boolean | ValidationResult; | ||
check?: (value: any, schema: ValidationSchema) => boolean | ValidationResult; | ||
} | ||
@@ -28,0 +28,0 @@ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -21,3 +21,4 @@ "use strict"; | ||
string: require("./rules/string"), | ||
url: require("./rules/url") | ||
url: require("./rules/url"), | ||
uuid: require("./rules/uuid") | ||
}; | ||
@@ -24,0 +25,0 @@ } |
{ | ||
"name": "fastest-validator", | ||
"version": "0.6.14", | ||
"version": "0.6.15", | ||
"description": "The fastest JS validator library for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -473,2 +473,19 @@ ![Photos from @ikukevk](https://user-images.githubusercontent.com/306521/30183963-9c722dca-941c-11e7-9e83-c78377ad7f9d.jpg) | ||
## `uuid` | ||
This is an UUID validator. | ||
```js | ||
let schema = { | ||
uuid: { type: "uuid" } | ||
} | ||
v.validate({ uuid: "10ba038e-48da-487b-96e8-8d3b99b6d18a" }, schema); // Valid UUIDv4 | ||
v.validate({ uuid: "9a7b330a-a736-51e5-af7f-feaf819cdc9f" }, schema); // Valid UUIDv5 | ||
v.validate({ uuid: "10ba038e-48da-487b-96e8-8d3b99b6d18a", version: 5 }, schema); // Fail | ||
``` | ||
### Properties | ||
Property | Default | Description | ||
-------- | -------- | ----------- | ||
`version` | `4` | UUID version in range 1-5. | ||
# Custom validator | ||
@@ -674,22 +691,28 @@ You can also create your custom validator. | ||
``` | ||
---------------|----------|----------|----------|----------|----------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines | | ||
---------------|----------|----------|----------|----------|----------------| | ||
All files | 100 | 100 | 100 | 100 | | | ||
lib | 100 | 100 | 100 | 100 | | | ||
messages.js | 100 | 100 | 100 | 100 | | | ||
validator.js | 100 | 100 | 100 | 100 | | | ||
lib/rules | 100 | 100 | 100 | 100 | | | ||
any.js | 100 | 100 | 100 | 100 | | | ||
array.js | 100 | 100 | 100 | 100 | | | ||
boolean.js | 100 | 100 | 100 | 100 | | | ||
date.js | 100 | 100 | 100 | 100 | | | ||
email.js | 100 | 100 | 100 | 100 | | | ||
forbidden.js | 100 | 100 | 100 | 100 | | | ||
function.js | 100 | 100 | 100 | 100 | | | ||
number.js | 100 | 100 | 100 | 100 | | | ||
object.js | 100 | 100 | 100 | 100 | | | ||
string.js | 100 | 100 | 100 | 100 | | | ||
url.js | 100 | 100 | 100 | 100 | | | ||
---------------|----------|----------|----------|----------|----------------| | ||
-----------------|----------|----------|----------|----------|-------------------| | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | | ||
-----------------|----------|----------|----------|----------|-------------------| | ||
All files | 100 | 100 | 100 | 100 | | | ||
lib | 100 | 100 | 100 | 100 | | | ||
messages.js | 100 | 100 | 100 | 100 | | | ||
validator.js | 100 | 100 | 100 | 100 | | | ||
lib/helpers | 100 | 100 | 100 | 100 | | | ||
deep-extend.js | 100 | 100 | 100 | 100 | | | ||
flatten.js | 100 | 100 | 100 | 100 | | | ||
lib/rules | 100 | 100 | 100 | 100 | | | ||
any.js | 100 | 100 | 100 | 100 | | | ||
array.js | 100 | 100 | 100 | 100 | | | ||
boolean.js | 100 | 100 | 100 | 100 | | | ||
custom.js | 100 | 100 | 100 | 100 | | | ||
date.js | 100 | 100 | 100 | 100 | | | ||
email.js | 100 | 100 | 100 | 100 | | | ||
enum.js | 100 | 100 | 100 | 100 | | | ||
forbidden.js | 100 | 100 | 100 | 100 | | | ||
function.js | 100 | 100 | 100 | 100 | | | ||
number.js | 100 | 100 | 100 | 100 | | | ||
object.js | 100 | 100 | 100 | 100 | | | ||
string.js | 100 | 100 | 100 | 100 | | | ||
url.js | 100 | 100 | 100 | 100 | | | ||
uuid.js | 100 | 100 | 100 | 100 | | | ||
-----------------|----------|----------|----------|----------|-------------------| | ||
``` | ||
@@ -696,0 +719,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
468403
75
2924
729