n4s 2.2.0-rc.1 → 4.0.0-dev-e266d9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/LICENSE +1 -2
- package/README.md +10 -4
- package/compose/package.json +7 -0
- package/compounds/package.json +7 -0
- package/dist/cjs/compose.development.js +139 -0
- package/dist/cjs/compose.js +7 -0
- package/dist/cjs/compose.production.js +1 -0
- package/dist/cjs/compounds.development.js +132 -0
- package/dist/cjs/compounds.js +7 -0
- package/dist/cjs/compounds.production.js +1 -0
- package/dist/cjs/n4s.development.js +602 -0
- package/dist/cjs/n4s.js +7 -0
- package/dist/cjs/n4s.production.js +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/schema.development.js +144 -0
- package/dist/cjs/schema.js +7 -0
- package/dist/cjs/schema.production.js +1 -0
- package/dist/es/compose.development.js +137 -0
- package/dist/es/compose.production.js +1 -0
- package/dist/es/compounds.development.js +130 -0
- package/dist/es/compounds.production.js +1 -0
- package/dist/es/n4s.development.js +597 -0
- package/dist/es/n4s.production.js +1 -0
- package/dist/es/package.json +1 -0
- package/dist/es/schema.development.js +140 -0
- package/dist/es/schema.production.js +1 -0
- package/dist/umd/compose.development.js +143 -0
- package/dist/umd/compose.production.js +1 -0
- package/dist/umd/compounds.development.js +136 -0
- package/dist/umd/compounds.production.js +1 -0
- package/dist/umd/n4s.development.js +606 -0
- package/dist/umd/n4s.production.js +1 -0
- package/dist/umd/schema.development.js +148 -0
- package/dist/umd/schema.production.js +1 -0
- package/docs/README.md +10 -4
- package/docs/_sidebar.md +2 -2
- package/docs/external.md +27 -0
- package/docs/rules.md +74 -0
- package/package.json +126 -67
- package/schema/package.json +7 -0
- package/tsconfig.json +8 -0
- package/types/compose.d.ts +134 -0
- package/types/compounds.d.ts +146 -0
- package/types/n4s.d.ts +167 -0
- package/types/schema.d.ts +151 -0
- package/config/rollup/enforce.js +0 -13
- package/config/rollup/enforceExtended.js +0 -10
- package/config/rollup/ensure.js +0 -10
- package/config/rollup/rollup.config.js +0 -5
- package/docs/business_rules.md +0 -80
- package/docs/custom.md +0 -54
- package/docs/ensure.md +0 -40
- package/enforceExtended.cjs.development.js +0 -1949
- package/enforceExtended.cjs.production.js +0 -1949
- package/enforceExtended.cjs.production.min.js +0 -1
- package/enforceExtended.umd.development.js +0 -1955
- package/enforceExtended.umd.production.js +0 -1972
- package/enforceExtended.umd.production.min.js +0 -1
- package/ensure.cjs.development.js +0 -418
- package/ensure.cjs.production.js +0 -418
- package/ensure.cjs.production.min.js +0 -1
- package/ensure.umd.development.js +0 -424
- package/ensure.umd.production.js +0 -444
- package/ensure.umd.production.min.js +0 -1
- package/esm/enforceExtended.mjs.development.js +0 -1947
- package/esm/enforceExtended.mjs.production.js +0 -1947
- package/esm/enforceExtended.mjs.production.min.js +0 -1
- package/esm/ensure.mjs.development.js +0 -416
- package/esm/ensure.mjs.production.js +0 -416
- package/esm/ensure.mjs.production.min.js +0 -1
- package/esm/n4s.mjs.development.js +0 -394
- package/esm/n4s.mjs.production.js +0 -394
- package/esm/n4s.mjs.production.min.js +0 -1
- package/esm/package.json +0 -1
- package/jest.config.js +0 -3
- package/n4s.cjs.development.js +0 -396
- package/n4s.cjs.production.js +0 -396
- package/n4s.cjs.production.min.js +0 -1
- package/n4s.umd.development.js +0 -402
- package/n4s.umd.index.js +0 -7
- package/n4s.umd.production.js +0 -419
- package/n4s.umd.production.min.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).enforceExtended=t()}(this,(function(){function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u,r=arguments[t];for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u])}return e}).apply(this,arguments)}function t(e){throw Error("[enforceExtended]: "+e)}function u(e){return function(){return!e.apply(this,arguments)}}function r(e,t){return"string"==typeof e&&"string"==typeof t&&e.endsWith(t)}function n(e,t){return e===t}function i(e){return!(isNaN(parseFloat(e))||isNaN(Number(e))||!isFinite(e))}function o(e,t){return i(e)&&i(t)&&Number(e)>Number(t)}function a(e,t){return i(e)&&i(t)&&Number(e)>=Number(t)}function s(e,t){return!!(Array.isArray(t)&&-1!==["string","number","boolean"].indexOf(typeof e)||"string"==typeof t&&"string"==typeof e)&&-1!==t.indexOf(e)}function d(e){return!!Array.isArray(e)}function c(e,t){return i(e)&&i(t)&&Number(e)<=Number(t)}function l(e,t,u){return a(e,t)&&c(e,u)}function f(e){return!e||(i(e)?0===e:Object.prototype.hasOwnProperty.call(e,"length")?0===e.length:"object"!=typeof e||0===Object.keys(e).length)}function $(e){return Number.isNaN(e)}function p(e){return!!i(e)&&0>Number(e)}function g(e){return null===e}function h(e){return"number"==typeof e}function b(e){return"string"==typeof e}function y(e){return!!e}function m(e){return void 0===e}function A(e,t){return e.length===t}function _(e,t){return i(e)&&i(t)&&Number(e)<Number(t)}function v(e,t){return t instanceof RegExp?t.test(e):"string"==typeof t&&new RegExp(t).test(e)}function Z(e,t){return i(e)&&i(t)&&Number(e)===Number(t)}function N(e,t){return"string"==typeof e&&"string"==typeof t&&e.startsWith(t)}function E(u,r){if("function"==typeof u){for(var n=arguments.length,i=Array(2<n?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];if(o=u.apply(void 0,[r].concat(i)),n={message:"[enforceExtended]/"+u.name+" invalid "+typeof r+" value"},"boolean"==typeof o||o&&"boolean"==typeof o.pass||t(u.name+" wrong return value for the rule please check that the return is valid"),"boolean"==typeof o?n=e({},n,{pass:o}):(i={pass:o.pass},o.message&&(o="function"==typeof o.message?o.message():o.message,i.message="[enforceExtended]/"+u.name+" "+o),n=e({},n,i)),!n.pass)throw Error(n.message)}}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e){if(!("string"==typeof e||e instanceof String)){if(null===e)var t="null";else t="object"===(t=S(e))&&e.constructor&&e.constructor.hasOwnProperty("name")?e.constructor.name:"a ".concat(t);throw new TypeError("Expected string but received ".concat(t,"."))}}function w(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},u=1<arguments.length?arguments[1]:void 0;for(e in u)void 0===t[e]&&(t[e]=u[e]);return t}function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e,t,u){if(x(e),"object"===F(t)){var r=t.min||0;t=t.max}else r=t,t=u;return(e=encodeURI(e).split(/%..|./).length-1)>=r&&(void 0===t||e<=t)}function I(e,t){x(e),(t=w(t,ye)).allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1)),e=e.split(".");for(var u=0;u<e.length;u++)if(63<e[u].length)return!1;if(t.require_tld&&(u=e.pop(),!e.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(u)||/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20\u00A9\uFFFD]/.test(u)))return!1;for(var r=0;r<e.length;r++)if(u=e[r],t.allow_underscores&&(u=u.replace(/_/g,"")),!/^[a-z\u00a1-\uffff0-9-]+$/i.test(u)||/[\uff01-\uff5e]/.test(u)||"-"===u[0]||"-"===u[u.length-1])return!1;return!0}function T(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if(x(e),!(t=String(t)))return T(e,4)||T(e,6);if("4"===t)return!!me.test(e)&&255>=e.split(".").sort((function(e,t){return e-t}))[3];if("6"===t){if(t=[e],e.includes("%")&&(2!==(t=e.split("%")).length||!t[0].includes(":")||""===t[1]))return!1;var u=!1,r=T((t=t[0].split(":"))[t.length-1],4),n=r?7:8;if(t.length>n)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(t.shift(),t.shift(),u=!0):"::"===e.substr(e.length-2)&&(t.pop(),t.pop(),u=!0);for(var i=0;i<t.length;++i)if(""===t[i]&&0<i&&i<t.length-1){if(u)return!1;u=!0}else if(!(r&&i===t.length-1||Ae.test(t[i])))return!1;return u?1<=t.length:t.length===n}return!1}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var u=0,r=Array(t);u<t;u++)r[u]=e[u];return r}function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t){for(var u=0;u<t.length;u++){var r=t[u];if(e===r||"[object RegExp]"===Object.prototype.toString.call(r)&&r.test(e))return!0}return!1}var L=function(e,u){return(e=Object.prototype.hasOwnProperty.call(e,u)&&"function"==typeof e[u])||t('Rule "'+u+'" was not found in rules object. Make sure you typed it correctly.'),e},U=Function("return this")(),D=u(r),M=u(n),j=u(i),z=u(s),B=u(d),G=u(l),q=u(f),H=u($),K=u(p),W=u(g),k=u(h),Y=u(b),J=u(y),X=u(m),V=u(A),Q=u(v),ee=u(Z),te=e({},{doesNotEndWith:D,doesNotStartWith:u(N),endsWith:r,equals:n,greaterThan:o,greaterThanOrEquals:a,gt:o,gte:a,inside:s,isArray:d,isBetween:l,isEmpty:f,isEven:function(e){return!!i(e)&&0==e%2},isFalsy:J,isNaN:$,isNegative:p,isNotArray:B,isNotBetween:G,isNotEmpty:q,isNotNaN:H,isNotNull:W,isNotNumber:k,isNotNumeric:j,isNotString:Y,isNotUndefined:X,isNull:g,isNumber:h,isNumeric:i,isOdd:function(e){return!!i(e)&&0!=e%2},isPositive:K,isString:b,isTruthy:y,isUndefined:m,lengthEquals:A,lengthNotEquals:V,lessThan:_,lessThanOrEquals:c,longerThan:function(e,t){return e.length>t},longerThanOrEquals:function(e,t){return e.length>=t},lt:_,lte:c,matches:v,notEquals:M,notInside:z,notMatches:Q,numberEquals:Z,numberNotEquals:ee,shorterThan:function(e,t){return e.length<t},shorterThanOrEquals:function(e,t){return e.length<=t},startsWith:N});if("function"==typeof U.Proxy)var ue=function(e){var t=new Proxy(te,{get:function(u,r){if(L(u,r))return function(){for(var n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];return E.apply(void 0,[u[r],e].concat(i)),t}}});return t};else{var re=Object.keys(te);ue=function(t){return re.reduce((function(u,r){var n;return Object.assign(u,e({},L(te,r)&&((n={})[r]=function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return E.apply(void 0,[te[r],t].concat(n)),u},n)))}),{})}}ue.extend=function(e){return Object.assign(te,e),"function"!=typeof U.Proxy&&(re=Object.keys(te)),ue};for(var ne,ie=ue,oe={"en-US":/^[0-9A-Z]+$/i,"bg-BG":/^[0-9\u0410-\u042f]+$/i,"cs-CZ":/^[0-9A-Z\u00c1\u010c\u010e\u00c9\u011a\u00cd\u0147\u00d3\u0158\u0160\u0164\u00da\u016e\u00dd\u017d]+$/i,"da-DK":/^[0-9A-Z\u00c6\u00d8\u00c5]+$/i,"de-DE":/^[0-9A-Z\u00c4\u00d6\u00dc\u00df]+$/i,"el-GR":/^[0-9\u0391-\u03c9]+$/i,"es-ES":/^[0-9A-Z\u00c1\u00c9\u00cd\u00d1\u00d3\u00da\u00dc]+$/i,"fr-FR":/^[0-9A-Z\u00c0\u00c2\u00c6\u00c7\u00c9\u00c8\u00ca\u00cb\u00cf\u00ce\u00d4\u0152\u00d9\u00db\u00dc\u0178]+$/i,"it-IT":/^[0-9A-Z\u00c0\u00c9\u00c8\u00cc\u00ce\u00d3\u00d2\u00d9]+$/i,"hu-HU":/^[0-9A-Z\u00c1\u00c9\u00cd\u00d3\u00d6\u0150\u00da\u00dc\u0170]+$/i,"nb-NO":/^[0-9A-Z\u00c6\u00d8\u00c5]+$/i,"nl-NL":/^[0-9A-Z\u00c1\u00c9\u00cb\u00cf\u00d3\u00d6\u00dc\u00da]+$/i,"nn-NO":/^[0-9A-Z\u00c6\u00d8\u00c5]+$/i,"pl-PL":/^[0-9A-Z\u0104\u0106\u0118\u015a\u0141\u0143\u00d3\u017b\u0179]+$/i,"pt-PT":/^[0-9A-Z\u00c3\u00c1\u00c0\u00c2\u00c4\u00c7\u00c9\u00ca\u00cb\u00cd\u00cf\u00d5\u00d3\u00d4\u00d6\u00da\u00dc]+$/i,"ru-RU":/^[0-9\u0410-\u042f\u0401]+$/i,"sl-SI":/^[0-9A-Z\u010c\u0106\u0110\u0160\u017d]+$/i,"sk-SK":/^[0-9A-Z\u00c1\u010c\u010e\u00c9\u00cd\u0147\u00d3\u0160\u0164\u00da\u00dd\u017d\u0139\u0154\u013d\u00c4\u00d4]+$/i,"sr-RS@latin":/^[0-9A-Z\u010c\u0106\u017d\u0160\u0110]+$/i,"sr-RS":/^[0-9\u0410-\u042f\u0402\u0408\u0409\u040a\u040b\u040f]+$/i,"sv-SE":/^[0-9A-Z\u00c5\u00c4\u00d6]+$/i,"tr-TR":/^[0-9A-Z\u00c7\u011e\u0130\u0131\u00d6\u015e\u00dc]+$/i,"uk-UA":/^[0-9\u0410-\u0429\u042c\u042e\u042f\u0404I\u0407\u0490\u0456]+$/i,"ku-IQ":/^[\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u06690-9\u0626\u0627\u0628\u067e\u062a\u062c\u0686\u062d\u062e\u062f\u0631\u0695\u0632\u0698\u0633\u0634\u0639\u063a\u0641\u06a4\u0642\u06a9\u06af\u0644\u06b5\u0645\u0646\u0648\u06c6\u06be\u06d5\u06cc\u06ce\u064a\u0637\u0624\u062b\u0622\u0625\u0623\u0643\u0636\u0635\u0629\u0638\u0630]+$/i,"vi-VN":/^[0-9A-Z\u00c0\u00c1\u1ea0\u1ea2\u00c3\u00c2\u1ea6\u1ea4\u1eac\u1ea8\u1eaa\u0102\u1eb0\u1eae\u1eb6\u1eb2\u1eb4\u0110\u00c8\u00c9\u1eb8\u1eba\u1ebc\u00ca\u1ec0\u1ebe\u1ec6\u1ec2\u1ec4\u00cc\u00cd\u1eca\u1ec8\u0128\u00d2\u00d3\u1ecc\u1ece\u00d5\u00d4\u1ed2\u1ed0\u1ed8\u1ed4\u1ed6\u01a0\u1edc\u1eda\u1ee2\u1ede\u1ee0\u00d9\u00da\u1ee4\u1ee6\u0168\u01af\u1eea\u1ee8\u1ef0\u1eec\u1eee\u1ef2\u00dd\u1ef4\u1ef6\u1ef8]+$/i,ar:/^[\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u06690-9\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652\u0670]+$/,he:/^[0-9\u05d0-\u05ea]+$/,fa:/^['0-9\u0622\u0627\u0621\u0623\u0624\u0626\u0628\u067e\u062a\u062b\u062c\u0686\u062d\u062e\u062f\u0630\u0631\u0632\u0698\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a\u0641\u0642\u06a9\u06af\u0644\u0645\u0646\u0648\u0647\u0629\u06cc\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u06f0']+$/i},ae="AU GB HK IN NZ ZA ZM".split(" "),se=0;se<ae.length;se++)ne="en-".concat(ae[se]),oe[ne]=oe["en-US"];for(var de,ce="AE BH DZ EG IQ JO KW LB LY MA QM QA SA SD SY TN YE".split(" "),le=0;le<ce.length;le++)de="ar-".concat(ce[le]),oe[de]=oe.ar;for(var fe,$e=["IR","AF"],pe=0;pe<$e.length;pe++)fe="fa-".concat($e[pe]),oe[fe]=oe.fa;oe["pt-BR"]=oe["pt-PT"],oe["pl-Pl"]=oe["pl-PL"];var ge=Object.keys(oe),he=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/,be={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1},ye={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1},me=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/,Ae=/^[0-9A-F]{1,4}$/i,_e={allow_display_name:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},ve=/^([^\x00-\x1F\x7F-\x9F\cX]+)<(.+)>$/i,Ze=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,Ne=/^[a-z\d]+$/,Ee=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,Se=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,xe=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,we={ES:function(e){x(e);var t={X:0,Y:1,Z:2};if(e=e.trim().toUpperCase(),!/^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/.test(e))return!1;var u=e.slice(0,-1).replace(/[X,Y,Z]/g,(function(e){return t[e]}));return e.endsWith("TRWAGMYFPDXBNJZSQVHLCKE".split("")[u%23])},IN:function(e){var t=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],u=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];if(e=e.trim(),!/^[1-9]\d{3}\s?\d{4}\s?\d{4}$/.test(e))return!1;var r=0;return e.replace(/\s/g,"").split("").map(Number).reverse().forEach((function(e,n){r=t[r][u[n%8][e]]})),0===r},IT:function(e){return 9===e.length&&"CA00000AA"!==e&&-1<e.search(/C[A-Z][0-9]{5}[A-Z]{2}/i)},NO:function(e){if(e=e.trim(),isNaN(Number(e))||11!==e.length||"00000000000"===e)return!1;var t=(11-(3*(e=e.split("").map(Number))[0]+7*e[1]+6*e[2]+1*e[3]+8*e[4]+9*e[5]+4*e[6]+5*e[7]+2*e[8])%11)%11,u=(11-(5*e[0]+4*e[1]+3*e[2]+2*e[3]+7*e[4]+6*e[5]+5*e[6]+4*e[7]+3*e[8]+2*t)%11)%11;return t===e[9]&&u===e[10]},"he-IL":function(e){if(e=e.trim(),!/^\d{9}$/.test(e))return!1;for(var t,u=0,r=0;r<e.length;r++)u+=9<(t=Number(e[r])*(r%2+1))?t-9:t;return 0==u%10},"ar-TN":function(e){return e=e.trim(),!!/^\d{8}$/.test(e)},"zh-CN":function(e){var t="11 12 13 14 15 21 22 23 31 32 33 34 35 36 37 41 42 43 44 45 46 50 51 52 53 54 61 62 63 64 65 71 81 82 91".split(" "),u="7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2".split(" "),r="10X98765432".split(""),n=function(e){var t=parseInt(e.substring(0,4),10),u=parseInt(e.substring(4,6),10);e=parseInt(e.substring(6),10);var r=new Date(t,u-1,e);return!(r>new Date||r.getFullYear()!==t||r.getMonth()!==u-1||r.getDate()!==e)},i=function(e){var i=/^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(e);if(!i)return!1;if(i=e.substring(0,2),!(i=t.includes(i)))return!1;if(i=e.substring(6,14),!(i=n(i)))return!1;i=e.substring(0,17);for(var o=0,a=0;17>a;a++)o+=parseInt(i.charAt(a),10)*parseInt(u[a],10);return r[o%11]===e.charAt(17).toUpperCase()};return function(e){if(/^\d{15}|(\d{17}(\d|x|X))$/.test(e))if(15===e.length){var u=/^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(e);u?(u=e.substring(0,2),(u=t.includes(u))?(e="19".concat(e.substring(6,12)),e=!!(u=n(e))):e=!1):e=!1}else e=i(e);else e=!1;return e}(e)},"zh-TW":function(e){var t={A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,I:34,J:18,K:19,L:20,M:21,N:22,O:35,P:23,Q:24,R:25,S:26,T:27,U:28,V:29,W:32,X:30,Y:31,Z:33};return e=e.trim().toUpperCase(),!!/^[A-Z][0-9]{9}$/.test(e)&&Array.from(e).reduce((function(e,u,r){return 0===r?(e=t[u])%10*9+Math.floor(e/10):9===r?0==(10-e%10-Number(u))%10:e+Number(u)*(9-r)}),0)}},Fe={allow_primitives:!1},Oe=/^[A-z]{2,4}([_-]([A-z]{4}|[\d]{3}))?([_-]([A-z]{2}|[\d]{3}))?$/,Ie=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,Te=/^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i,Pe=/^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i,Re={"am-AM":/^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-BH":/^(\+?973)?(3|6)\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[0125]\d{8}$/,"ar-IQ":/^(\+?964|0)?7[0-9]\d{8}$/,"ar-JO":/^(\+?962|0)?7[789]\d{7}$/,"ar-KW":/^(\+?965)[569]\d{7}$/,"ar-LY":/^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,"ar-SA":/^(!?(\+?966)|0)?5\d{8}$/,"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"ar-TN":/^(\+?216)?[2459]\d{7}$/,"az-AZ":/^(\+994|0)(5[015]|7[07]|99)\d{7}$/,"bs-BA":/^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,"be-BY":/^(\+?375)?(24|25|29|33|44)\d{7}$/,"bg-BG":/^(\+?359|0)?8[789]\d{7}$/,"bn-BD":/^(\+?880|0)1[13456789][0-9]{8}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"da-DK":/^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,"de-DE":/^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,"de-AT":/^(\+43|0)\d{1,4}\d{3,12}$/,"de-CH":/^(\+41|0)(7[5-9])\d{1,7}$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-GG":/^(\+?44|0)1481\d{6}$/,"en-GH":/^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,"en-HK":/^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,"en-MO":/^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,"en-IE":/^(\+?353|0)8[356789]\d{7}$/,"en-IN":/^(\+?91|0)?[6789]\d{9}$/,"en-KE":/^(\+?254|0)(7|1)\d{8}$/,"en-MT":/^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,"en-MU":/^(\+?230|0)?\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)[28]\d{7,9}$/,"en-PK":/^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,"en-PH":/^(09|\+639)\d{9}$/,"en-RW":/^(\+?250|0)?[7]\d{8}$/,"en-SG":/^(\+65)?[689]\d{7}$/,"en-SL":/^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"en-ZW":/^(\+263)[0-9]{9}$/,"es-CO":/^(\+?57)?([1-8]{1}|3[0-9]{2})?[2-9]{1}\d{6}$/,"es-CL":/^(\+?56|0)[2-9]\d{1}\d{7}$/,"es-CR":/^(\+506)?[2-8]\d{7}$/,"es-EC":/^(\+?593|0)([2-7]|9[2-9])\d{7}$/,"es-ES":/^(\+?34)?[6|7]\d{8}$/,"es-MX":/^(\+?52)?(1|01)?\d{10,11}$/,"es-PA":/^(\+?507)\d{7,8}$/,"es-PY":/^(\+?595|0)9[9876]\d{7}$/,"es-UY":/^(\+598|0)9[1-9][\d]{6}$/,"et-EE":/^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,"fa-IR":/^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,"fj-FJ":/^(\+?679)?\s?\d{3}\s?\d{4}$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"fr-GF":/^(\+?594|0|00594)[67]\d{8}$/,"fr-GP":/^(\+?590|0|00590)[67]\d{8}$/,"fr-MQ":/^(\+?596|0|00596)[67]\d{8}$/,"fr-RE":/^(\+?262|0|00262)[67]\d{8}$/,"he-IL":/^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,"hu-HU":/^(\+?36)(20|30|70)\d{7}$/,"id-ID":/^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ja-JP":/^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,"kk-KZ":/^(\+?7|8)?7\d{9}$/,"kl-GL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^\d{5}(-\d{4})?$/,ZA:Ue,ZM:De},ze=Object.keys(je),Be={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,validate_length:!0},Ge=/^\[([^\]]+)\](?::([0-9]+))?$/;return ie.extend({isAlphanumeric:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"en-US";if(x(e),t in oe)return oe[t].test(e);throw Error("Invalid locale '".concat(t,"'"))},isCreditCard:function(e){if(x(e),e=e.replace(/[- ]+/g,""),!he.test(e))return!1;for(var t,u,r=0,n=e.length-1;0<=n;n--)t=e.substring(n,n+1),t=parseInt(t,10),u?r=10<=(t*=2)?r+(t%10+1):r+t:r+=t,u=!u;return!(0!=r%10||!e)},isCurrency:function(e,t){return x(e),function(e){var t="\\d{".concat(e.digits_after_decimal[0],"}");e.digits_after_decimal.forEach((function(e,u){0!==u&&(t="".concat(t,"|\\d{").concat(e,"}"))}));var u="(".concat(e.symbol.replace(/\W/,(function(e){return"\\".concat(e)})),")").concat(e.require_symbol?"":"?"),r=["0","[1-9]\\d*","[1-9]\\d{0,2}(\\".concat(e.thousands_separator,"\\d{3})*")];r="(".concat(r.join("|"),")?");var n="(\\".concat(e.decimal_separator,"(").concat(t,"))").concat(e.require_decimal?"":"?");return r+=e.allow_decimal||e.require_decimal?n:"",e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?r+="-?":e.negative_sign_before_digits&&(r="-?"+r)),e.allow_negative_sign_placeholder?r="( (?!\\-))?".concat(r):e.allow_space_after_symbol?r=" ?".concat(r):e.allow_space_after_digits&&(r+="( (?!$))?"),r=e.symbol_after_digits?r+u:u+r,e.allow_negatives&&(e.parens_for_negatives?r="(\\(".concat(r,"\\)|").concat(r,")"):e.negative_sign_before_digits||e.negative_sign_after_digits||(r="-?"+r)),new RegExp("^(?!-? )(?=.*\\d)".concat(r,"$"))}(t=w(t,be)).test(e)},isEmail:function(e,t){if(x(e),(t=w(t,_e)).require_display_name||t.allow_display_name){var u=e.match(ve);if(u){if(!(e=Array.isArray(u)?u:void 0))if("undefined"!=typeof Symbol&&Symbol.iterator in Object(u)){e=[];var r=!0,n=!1,i=void 0;try{for(var o,a=u[Symbol.iterator]();!(r=(o=a.next()).done)&&(e.push(o.value),3!==e.length);r=!0);}catch(e){n=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}}else e=void 0;if(!(a=e))e:{if(u){if("string"==typeof u){a=P(u,3);break e}if("Object"===(a=Object.prototype.toString.call(u).slice(8,-1))&&u.constructor&&(a=u.constructor.name),"Map"===a||"Set"===a){a=Array.from(u);break e}if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)){a=P(u,3);break e}}a=void 0}if(!a)throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");if(u=a[1],e=a[2],u.endsWith(" ")&&(u=u.substr(0,u.length-1)),!(a=(u=(a=u).match(/^"(.+)"$/i))?u[1]:a).trim()||/[\.";<>]/.test(a)&&(!u||a.split('"').length!==a.split('\\"').length))return!1}else if(t.require_display_name)return!1}if(!t.ignore_max_length&&254<e.length)return!1;if(a=(u=e.split("@")).pop(),u=u.join("@"),o=a.toLowerCase(),t.domain_specific_validation&&("gmail.com"===o||"googlemail.com"===o)){if(!O((o=(u=u.toLowerCase()).split("+")[0]).replace(".",""),{min:6,max:30}))return!1;for(o=o.split("."),e=0;e<o.length;e++)if(!Ne.test(o[e]))return!1}if(!O(u,{max:64})||!O(a,{max:254}))return!1;if(!I(a,{require_tld:t.require_tld})){if(!t.allow_ip_domain)return!1;if(!T(a)){if(!a.startsWith("[")||!a.endsWith("]"))return!1;if(0===(a=a.substr(1,a.length-2)).length||!T(a))return!1}}if('"'===u[0])return u=u.slice(1,u.length-1),t.allow_utf8_local_part?xe.test(u):Ee.test(u);for(t=t.allow_utf8_local_part?Se:Ze,u=u.split("."),a=0;a<u.length;a++)if(!t.test(u[a]))return!1;return!0},isIP:T,isIdentityCard:function(e,t){if(x(e),t in we)return we[t](e);if("any"===t){for(var u in we)if(we.hasOwnProperty(u)&&(0,we[u])(e))return!0;return!1}throw Error("Invalid locale '".concat(t,"'"))},isJSON:function(e,t){x(e);try{t=w(t,Fe);var u=[];t.allow_primitives&&(u=[null,!1,!0]);var r=JSON.parse(e);return u.includes(r)||!!r&&"object"===R(r)}catch(e){}return!1},isLocale:function(e){return x(e),"en_US_POSIX"===e||"ca_ES_VALENCIA"===e||Oe.test(e)},isMimeType:function(e){return x(e),Ie.test(e)||Te.test(e)||Pe.test(e)},isMobilePhone:function(e,t,u){if(x(e),u&&u.strictMode&&!e.startsWith("+"))return!1;if(Array.isArray(t))return t.some((function(t){return!(!Re.hasOwnProperty(t)||!Re[t].test(e))}));if(t in Re)return Re[t].test(e);if(!t||"any"===t){for(var r in Re)if(Re.hasOwnProperty(r)&&Re[r].test(e))return!0;return!1}throw Error("Invalid locale '".concat(t,"'"))},isPassportNumber:function(e,t){return x(e),e=e.replace(/\s/g,"").toUpperCase(),t.toUpperCase()in Le&&Le[t].test(e)},isPostalCode:function(e,t){if(x(e),t in je)return je[t].test(e);if("any"===t){for(var u in je)if(je.hasOwnProperty(u)&&je[u].test(e))return!0;return!1}throw Error("Invalid locale '".concat(t,"'"))},isURL:function(e,t){if(x(e),!e||/[\s<>]/.test(e)||0===e.indexOf("mailto:"))return!1;if((t=w(t,Be)).validate_length&&2083<=e.length)return!1;var u=e.split("#");if(e=u.shift(),u=e.split("?"),e=u.shift(),1<(u=e.split("://")).length){if(e=u.shift().toLowerCase(),t.require_valid_protocol&&-1===t.protocols.indexOf(e))return!1}else{if(t.require_protocol)return!1;if("//"===e.substr(0,2)){if(!t.allow_protocol_relative_urls)return!1;u[0]=e.substr(2)}}if(""===(e=u.join("://")))return!1;if(u=e.split("/"),""===(e=u.shift())&&!t.require_host)return!0;if(1<(u=e.split("@")).length){if(t.disallow_auth)return!1;if(-1===(e=u.shift()).indexOf(":")||0<=e.indexOf(":")&&2<e.split(":").length)return!1}var r=u.join("@"),n=e=null;return(u=r.match(Ge))?(r="",n=u[1],e=u[2]||null):(u=r.split(":"),r=u.shift(),u.length&&(e=u.join(":"))),!(null!==e&&(u=parseInt(e,10),!/^[0-9]+$/.test(e)||0>=u||65535<u)||!(T(r)||I(r,t)||n&&T(n,6)))&&(r=r||n,!(t.host_whitelist&&!C(r,t.host_whitelist)||t.host_blacklist&&C(r,t.host_blacklist)))}}),Object.assign(ie,{isAlphanumericLocales:ge,isMobilePhoneLocales:Ce,isPostalCodeLocales:ze})}));
|
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _extends() {
|
|
4
|
-
_extends = Object.assign || function (target) {
|
|
5
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
6
|
-
var source = arguments[i];
|
|
7
|
-
|
|
8
|
-
for (var key in source) {
|
|
9
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
10
|
-
target[key] = source[key];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return target;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return _extends.apply(this, arguments);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function throwError(message) {
|
|
22
|
-
throw new Error(`[${"ensure"}]: ${message}`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const isRule = (rulesObject, name) => {
|
|
26
|
-
const ruleExists = Object.prototype.hasOwnProperty.call(rulesObject, name) && typeof rulesObject[name] === 'function';
|
|
27
|
-
|
|
28
|
-
if (!ruleExists) {
|
|
29
|
-
throwError(`Rule "${name}" was not found in rules object. Make sure you typed it correctly.`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return ruleExists;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const GLOBAL_OBJECT = Function('return this')();
|
|
36
|
-
|
|
37
|
-
const proxySupported = () => typeof GLOBAL_OBJECT.Proxy === 'function';
|
|
38
|
-
|
|
39
|
-
function bindNot(fn) {
|
|
40
|
-
return function () {
|
|
41
|
-
return !fn.apply(this, arguments);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function endsWith(value, arg1) {
|
|
46
|
-
return typeof value === 'string' && typeof arg1 === 'string' && value.endsWith(arg1);
|
|
47
|
-
}
|
|
48
|
-
const doesNotEndWith = bindNot(endsWith);
|
|
49
|
-
|
|
50
|
-
function equals(value, arg1) {
|
|
51
|
-
return value === arg1;
|
|
52
|
-
}
|
|
53
|
-
const notEquals = bindNot(equals);
|
|
54
|
-
|
|
55
|
-
function isNumeric(value) {
|
|
56
|
-
const result = !isNaN(parseFloat(value)) && !isNaN(Number(value)) && isFinite(value);
|
|
57
|
-
return Boolean(result);
|
|
58
|
-
}
|
|
59
|
-
const isNotNumeric = bindNot(isNumeric);
|
|
60
|
-
|
|
61
|
-
function greaterThan(value, arg1) {
|
|
62
|
-
return isNumeric(value) && isNumeric(arg1) && Number(value) > Number(arg1);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function greaterThanOrEquals(value, arg1) {
|
|
66
|
-
return isNumeric(value) && isNumeric(arg1) && Number(value) >= Number(arg1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function inside(value, arg1) {
|
|
70
|
-
if (Array.isArray(arg1) && ['string', 'number', 'boolean'].indexOf(typeof value) !== -1) {
|
|
71
|
-
return arg1.indexOf(value) !== -1;
|
|
72
|
-
} // both value and arg1 are strings
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (typeof arg1 === 'string' && typeof value === 'string') {
|
|
76
|
-
return arg1.indexOf(value) !== -1;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
const notInside = bindNot(inside);
|
|
82
|
-
|
|
83
|
-
function isArray(value) {
|
|
84
|
-
return Boolean(Array.isArray(value));
|
|
85
|
-
}
|
|
86
|
-
const isNotArray = bindNot(isArray);
|
|
87
|
-
|
|
88
|
-
function lessThanOrEquals(value, arg1) {
|
|
89
|
-
return isNumeric(value) && isNumeric(arg1) && Number(value) <= Number(arg1);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function isBetween(value, min, max) {
|
|
93
|
-
return greaterThanOrEquals(value, min) && lessThanOrEquals(value, max);
|
|
94
|
-
}
|
|
95
|
-
const isNotBetween = bindNot(isBetween);
|
|
96
|
-
|
|
97
|
-
function isEmpty(value) {
|
|
98
|
-
if (!value) {
|
|
99
|
-
return true;
|
|
100
|
-
} else if (isNumeric(value)) {
|
|
101
|
-
return value === 0;
|
|
102
|
-
} else if (Object.prototype.hasOwnProperty.call(value, 'length')) {
|
|
103
|
-
return value.length === 0;
|
|
104
|
-
} else if (typeof value === 'object') {
|
|
105
|
-
return Object.keys(value).length === 0;
|
|
106
|
-
} else {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const isNotEmpty = bindNot(isEmpty);
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Validates that a given value is an even number
|
|
114
|
-
* @param {Number|String} value Value to be validated
|
|
115
|
-
* @return {Boolean}
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
const isEven = value => {
|
|
119
|
-
if (!isNumeric(value)) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return value % 2 === 0;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
function isNaN$1(value) {
|
|
127
|
-
return Number.isNaN(value);
|
|
128
|
-
}
|
|
129
|
-
const isNotNaN = bindNot(isNaN$1);
|
|
130
|
-
|
|
131
|
-
function isNegative(value) {
|
|
132
|
-
if (isNumeric(value)) {
|
|
133
|
-
return Number(value) < 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
const isPositive = bindNot(isNegative);
|
|
139
|
-
|
|
140
|
-
function isNull(value) {
|
|
141
|
-
return value === null;
|
|
142
|
-
}
|
|
143
|
-
const isNotNull = bindNot(isNull);
|
|
144
|
-
|
|
145
|
-
function isNumber(value) {
|
|
146
|
-
return Boolean(typeof value === 'number');
|
|
147
|
-
}
|
|
148
|
-
const isNotNumber = bindNot(isNumber);
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Validates that a given value is an odd number
|
|
152
|
-
* @param {Number|String} value Value to be validated
|
|
153
|
-
* @return {Boolean}
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
const isOdd = value => {
|
|
157
|
-
if (!isNumeric(value)) {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return value % 2 !== 0;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
function isString(value) {
|
|
165
|
-
return Boolean(typeof value === 'string');
|
|
166
|
-
}
|
|
167
|
-
const isNotString = bindNot(isString);
|
|
168
|
-
|
|
169
|
-
function isTruthy(value) {
|
|
170
|
-
return !!value;
|
|
171
|
-
}
|
|
172
|
-
const isFalsy = bindNot(isTruthy);
|
|
173
|
-
|
|
174
|
-
function isUndefined(value) {
|
|
175
|
-
return value === undefined;
|
|
176
|
-
}
|
|
177
|
-
const isNotUndefined = bindNot(isUndefined);
|
|
178
|
-
|
|
179
|
-
function lengthEquals(value, arg1) {
|
|
180
|
-
return value.length === arg1;
|
|
181
|
-
}
|
|
182
|
-
const lengthNotEquals = bindNot(lengthEquals);
|
|
183
|
-
|
|
184
|
-
function lessThan(value, arg1) {
|
|
185
|
-
return isNumeric(value) && isNumeric(arg1) && Number(value) < Number(arg1);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function longerThan(value, arg1) {
|
|
189
|
-
return value.length > arg1;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function longerThanOrEquals(value, arg1) {
|
|
193
|
-
return value.length >= arg1;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
function matches(value, regex) {
|
|
197
|
-
if (regex instanceof RegExp) {
|
|
198
|
-
return regex.test(value);
|
|
199
|
-
} else if (typeof regex === 'string') {
|
|
200
|
-
return new RegExp(regex).test(value);
|
|
201
|
-
} else {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const notMatches = bindNot(matches);
|
|
206
|
-
|
|
207
|
-
function numberEquals(value, arg1) {
|
|
208
|
-
return isNumeric(value) && isNumeric(arg1) && Number(value) === Number(arg1);
|
|
209
|
-
}
|
|
210
|
-
const numberNotEquals = bindNot(numberEquals);
|
|
211
|
-
|
|
212
|
-
function shorterThan(value, arg1) {
|
|
213
|
-
return value.length < arg1;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function shorterThanOrEquals(value, arg1) {
|
|
217
|
-
return value.length <= arg1;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function startsWith(value, arg1) {
|
|
221
|
-
return typeof value === 'string' && typeof arg1 === 'string' && value.startsWith(arg1);
|
|
222
|
-
}
|
|
223
|
-
const doesNotStartWith = bindNot(startsWith);
|
|
224
|
-
|
|
225
|
-
var rules = {
|
|
226
|
-
doesNotEndWith,
|
|
227
|
-
doesNotStartWith,
|
|
228
|
-
endsWith,
|
|
229
|
-
equals,
|
|
230
|
-
greaterThan,
|
|
231
|
-
greaterThanOrEquals,
|
|
232
|
-
gt: greaterThan,
|
|
233
|
-
gte: greaterThanOrEquals,
|
|
234
|
-
inside,
|
|
235
|
-
isArray,
|
|
236
|
-
isBetween,
|
|
237
|
-
isEmpty,
|
|
238
|
-
isEven,
|
|
239
|
-
isFalsy,
|
|
240
|
-
isNaN: isNaN$1,
|
|
241
|
-
isNegative,
|
|
242
|
-
isNotArray,
|
|
243
|
-
isNotBetween,
|
|
244
|
-
isNotEmpty,
|
|
245
|
-
isNotNaN,
|
|
246
|
-
isNotNull,
|
|
247
|
-
isNotNumber,
|
|
248
|
-
isNotNumeric,
|
|
249
|
-
isNotString,
|
|
250
|
-
isNotUndefined,
|
|
251
|
-
isNull,
|
|
252
|
-
isNumber,
|
|
253
|
-
isNumeric,
|
|
254
|
-
isOdd,
|
|
255
|
-
isPositive,
|
|
256
|
-
isString,
|
|
257
|
-
isTruthy,
|
|
258
|
-
isUndefined,
|
|
259
|
-
lengthEquals,
|
|
260
|
-
lengthNotEquals,
|
|
261
|
-
lessThan,
|
|
262
|
-
lessThanOrEquals,
|
|
263
|
-
longerThan,
|
|
264
|
-
longerThanOrEquals,
|
|
265
|
-
lt: lessThan,
|
|
266
|
-
lte: lessThanOrEquals,
|
|
267
|
-
matches,
|
|
268
|
-
notEquals,
|
|
269
|
-
notInside,
|
|
270
|
-
notMatches,
|
|
271
|
-
numberEquals,
|
|
272
|
-
numberNotEquals,
|
|
273
|
-
shorterThan,
|
|
274
|
-
shorterThanOrEquals,
|
|
275
|
-
startsWith
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
function validateResult(result, rule) {
|
|
279
|
-
if (typeof result !== 'boolean' && (!result || typeof result.pass !== 'boolean')) {
|
|
280
|
-
throwError(`${rule.name} wrong return value for the rule please check that the return is valid`);
|
|
281
|
-
}
|
|
282
|
-
} // for easier testing and mocking
|
|
283
|
-
|
|
284
|
-
function getDefaultResult(value, rule) {
|
|
285
|
-
return {
|
|
286
|
-
message: formatResultMessage(rule, `invalid ${typeof value} value`)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
function formatResultMessage(rule, msg) {
|
|
290
|
-
return `[${"ensure"}]/${rule.name} ${msg}`;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Transform the result of a rule into a standard format
|
|
294
|
-
* @param {string} interfaceName to be used in the messages
|
|
295
|
-
* @param {*} result of the rule
|
|
296
|
-
* @param {Object} options
|
|
297
|
-
* @param {function} options.rule
|
|
298
|
-
* @param {*} options.value
|
|
299
|
-
* @returns {Object} result
|
|
300
|
-
* @returns {string} result.message
|
|
301
|
-
* @returns {boolean} result.pass indicates if the test passes or not
|
|
302
|
-
*/
|
|
303
|
-
|
|
304
|
-
function transformResult(result, {
|
|
305
|
-
rule,
|
|
306
|
-
value
|
|
307
|
-
}) {
|
|
308
|
-
const defaultResult = getDefaultResult(value, rule);
|
|
309
|
-
validateResult(result, rule);
|
|
310
|
-
|
|
311
|
-
if (typeof result === 'boolean') {
|
|
312
|
-
return _extends({}, defaultResult, {
|
|
313
|
-
pass: result
|
|
314
|
-
});
|
|
315
|
-
} else {
|
|
316
|
-
const formattedResult = {
|
|
317
|
-
pass: result.pass
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
if (result.message) {
|
|
321
|
-
formattedResult.message = formatResultMessage(rule, typeof result.message === 'function' ? result.message() : result.message);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
return _extends({}, defaultResult, formattedResult);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Run a single rule against ensured value (e.g. `isNumber()`)
|
|
330
|
-
* @param {Function} rule - rule to run
|
|
331
|
-
* @param {Any} value
|
|
332
|
-
* @param {Array} args list of arguments sent from consumer
|
|
333
|
-
* @return {Boolean}
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
function runner(rule, value, ...args) {
|
|
337
|
-
try {
|
|
338
|
-
const result = rule(value, ...args);
|
|
339
|
-
return transformResult(result, {
|
|
340
|
-
rule,
|
|
341
|
-
value
|
|
342
|
-
}).pass;
|
|
343
|
-
} catch (err) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Accepts list of registered rules and returns a test function
|
|
350
|
-
* That runs against them to return a boolean
|
|
351
|
-
*
|
|
352
|
-
* @param {Array} registeredRules
|
|
353
|
-
* @return {Function} test function
|
|
354
|
-
*/
|
|
355
|
-
|
|
356
|
-
const createTestFn = registeredRules => value => registeredRules.every(({
|
|
357
|
-
name,
|
|
358
|
-
args
|
|
359
|
-
}) => runner(rulesObject[name], value, ...args));
|
|
360
|
-
|
|
361
|
-
let ensure, rulesList;
|
|
362
|
-
|
|
363
|
-
const rulesObject = _extends({}, rules);
|
|
364
|
-
|
|
365
|
-
if (proxySupported()) {
|
|
366
|
-
ensure = () => {
|
|
367
|
-
const registeredRules = [];
|
|
368
|
-
const proxy = new Proxy(rulesObject, {
|
|
369
|
-
get: (rules, ruleName) => {
|
|
370
|
-
if (ruleName === 'test') {
|
|
371
|
-
return createTestFn(registeredRules);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (!isRule(rulesObject, ruleName)) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return (...args) => {
|
|
379
|
-
registeredRules.push({
|
|
380
|
-
name: ruleName,
|
|
381
|
-
args
|
|
382
|
-
});
|
|
383
|
-
return proxy;
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
});
|
|
387
|
-
return proxy;
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
rulesList = Object.keys(rulesObject);
|
|
392
|
-
|
|
393
|
-
ensure = () => {
|
|
394
|
-
const registeredRules = [];
|
|
395
|
-
return rulesList.reduce((allRules, ruleName) => Object.assign(allRules, _extends({}, isRule(rulesObject, ruleName) && {
|
|
396
|
-
[ruleName]: (...args) => {
|
|
397
|
-
registeredRules.push({
|
|
398
|
-
name: ruleName,
|
|
399
|
-
args
|
|
400
|
-
});
|
|
401
|
-
return allRules;
|
|
402
|
-
}
|
|
403
|
-
})), {
|
|
404
|
-
test: createTestFn(registeredRules)
|
|
405
|
-
});
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
ensure.extend = customRules => {
|
|
409
|
-
Object.assign(rulesObject, customRules);
|
|
410
|
-
|
|
411
|
-
if (proxySupported()) {
|
|
412
|
-
rulesList = Object.keys(rulesObject);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
var ensure$1 = ensure;
|
|
417
|
-
|
|
418
|
-
module.exports = ensure$1;
|