Socket
Socket
Sign inDemoInstall

@kingshott/iodine

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kingshott/iodine - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

2

dist/iodine.min.esm.js

@@ -1,2 +0,2 @@

function e(r,s,i){if(!r.s){if(i instanceof t){if(!i.s)return void(i.o=e.bind(null,r,s));1&s&&(s=i.s),i=i.v}if(i&&i.then)return void i.then(e.bind(null,r,s),e.bind(null,r,2));r.s=s,r.v=i;const n=r.o;n&&n(r)}}const t=function(){function t(){}return t.prototype.then=function(r,s){const i=new t,n=this.s;if(n){const t=1&n?r:s;if(t){try{e(i,1,t(this.v))}catch(t){e(i,2,t)}return i}return this}return this.o=function(t){try{const n=t.v;1&t.s?e(i,1,r?r(n):n):s?e(i,1,s(n)):e(i,2,n)}catch(t){e(i,2,t)}},i},t}();class r{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(e,t){r.prototype[`is${this._titleCase(e)}`]=t}asyncIs(r,s=[]){try{let i;const n=this,a=function(a,o,u){var l=[];for(var h in a)l.push(h);return function(r,s,i){var n,a,o=-1;return function u(l){try{for(;++o<r.length&&(!i||!i());)if((l=s(o))&&l.then){if(!((h=l)instanceof t&&1&h.s))return void l.then(u,a||(a=e.bind(null,n=new t,2)));l=l.v}n?e(n,1,l):n=l}catch(r){e(n||(n=new t),2,r)}var h}(),n}(l,function(e){return t=l[e],Promise.resolve(n[`is${s[t][1]}`].apply(n,[r,s[t][2].join(":")])).then(function(e){return function(){if(!e)return i=1,Promise.resolve(s[t][0])}()});var t},function(){return i})}(s=n._prepare(r,s));return Promise.resolve(a&&a.then?a.then(function(e){return!i||e}):!i||a)}catch(e){return Promise.reject(e)}}asyncIsValid(e,t=[]){try{return Promise.resolve(this.asyncIs(e,t)).then(function(e){return!0===e})}catch(e){return Promise.reject(e)}}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let n=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(n)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let a=[null,void 0,""].includes(r)?this.messages[n]:this.messages[n].replace("[PARAM]",r);return[null,void 0,""].includes(s)?a.replace("[FIELD]",this.defaultFieldName):a.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}window.Iodine=new r;export{r as Iodine};
function e(r,s,i){if(!r.s){if(i instanceof t){if(!i.s)return void(i.o=e.bind(null,r,s));1&s&&(s=i.s),i=i.v}if(i&&i.then)return void i.then(e.bind(null,r,s),e.bind(null,r,2));r.s=s,r.v=i;const n=r.o;n&&n(r)}}const t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(r,s){const i=new t,n=this.s;if(n){const t=1&n?r:s;if(t){try{e(i,1,t(this.v))}catch(t){e(i,2,t)}return i}return this}return this.o=function(t){try{const n=t.v;1&t.s?e(i,1,r?r(n):n):s?e(i,1,s(n)):e(i,2,n)}catch(t){e(i,2,t)}},i},t}();class r{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(e,t){r.prototype[`is${this._titleCase(e)}`]=t}asyncIs(r,s=[]){try{let i;const n=this,a=function(a,o,u){var l=[];for(var h in a)l.push(h);return function(r,s,i){var n,a,o=-1;return function u(l){try{for(;++o<r.length&&(!i||!i());)if((l=s(o))&&l.then){if(!((h=l)instanceof t&&1&h.s))return void l.then(u,a||(a=e.bind(null,n=new t,2)));l=l.v}n?e(n,1,l):n=l}catch(r){e(n||(n=new t),2,r)}var h}(),n}(l,function(e){return t=l[e],Promise.resolve(n[`is${s[t][1]}`].apply(n,[r,s[t][2].join(":")])).then(function(e){return function(){if(!e)return Promise.resolve(s[t][0]).then(function(e){return i=1,e})}()});var t},function(){return i})}(s=n._prepare(r,s));return Promise.resolve(a&&a.then?a.then(function(e){return!i||e}):!i||a)}catch(e){return Promise.reject(e)}}asyncIsValid(e,t=[]){try{return Promise.resolve(this.asyncIs(e,t)).then(function(e){return!0===e})}catch(e){return Promise.reject(e)}}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let n=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(n)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let a=[null,void 0,""].includes(r)?this.messages[n]:this.messages[n].replace("[PARAM]",r);return[null,void 0,""].includes(s)?a.replace("[FIELD]",this.defaultFieldName):a.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}"undefined"!=typeof window&&(window.Iodine=new r);export{r as Iodine};
//# sourceMappingURL=iodine.min.esm.js.map

@@ -1,2 +0,2 @@

function e(r,s,i){if(!r.s){if(i instanceof t){if(!i.s)return void(i.o=e.bind(null,r,s));1&s&&(s=i.s),i=i.v}if(i&&i.then)return void i.then(e.bind(null,r,s),e.bind(null,r,2));r.s=s,r.v=i;const n=r.o;n&&n(r)}}const t=function(){function t(){}return t.prototype.then=function(r,s){const i=new t,n=this.s;if(n){const t=1&n?r:s;if(t){try{e(i,1,t(this.v))}catch(t){e(i,2,t)}return i}return this}return this.o=function(t){try{const n=t.v;1&t.s?e(i,1,r?r(n):n):s?e(i,1,s(n)):e(i,2,n)}catch(t){e(i,2,t)}},i},t}();class r{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(e,t){r.prototype[`is${this._titleCase(e)}`]=t}asyncIs(r,s=[]){try{let i;const n=this,a=function(a,o,u){var l=[];for(var h in a)l.push(h);return function(r,s,i){var n,a,o=-1;return function u(l){try{for(;++o<r.length&&(!i||!i());)if((l=s(o))&&l.then){if(!((h=l)instanceof t&&1&h.s))return void l.then(u,a||(a=e.bind(null,n=new t,2)));l=l.v}n?e(n,1,l):n=l}catch(r){e(n||(n=new t),2,r)}var h}(),n}(l,function(e){return t=l[e],Promise.resolve(n[`is${s[t][1]}`].apply(n,[r,s[t][2].join(":")])).then(function(e){return function(){if(!e)return i=1,Promise.resolve(s[t][0])}()});var t},function(){return i})}(s=n._prepare(r,s));return Promise.resolve(a&&a.then?a.then(function(e){return!i||e}):!i||a)}catch(e){return Promise.reject(e)}}asyncIsValid(e,t=[]){try{return Promise.resolve(this.asyncIs(e,t)).then(function(e){return!0===e})}catch(e){return Promise.reject(e)}}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let n=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(n)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let a=[null,void 0,""].includes(r)?this.messages[n]:this.messages[n].replace("[PARAM]",r);return[null,void 0,""].includes(s)?a.replace("[FIELD]",this.defaultFieldName):a.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}window.Iodine=new r,exports.Iodine=r;
function e(r,s,i){if(!r.s){if(i instanceof t){if(!i.s)return void(i.o=e.bind(null,r,s));1&s&&(s=i.s),i=i.v}if(i&&i.then)return void i.then(e.bind(null,r,s),e.bind(null,r,2));r.s=s,r.v=i;const n=r.o;n&&n(r)}}const t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(r,s){const i=new t,n=this.s;if(n){const t=1&n?r:s;if(t){try{e(i,1,t(this.v))}catch(t){e(i,2,t)}return i}return this}return this.o=function(t){try{const n=t.v;1&t.s?e(i,1,r?r(n):n):s?e(i,1,s(n)):e(i,2,n)}catch(t){e(i,2,t)}},i},t}();class r{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(e,t){r.prototype[`is${this._titleCase(e)}`]=t}asyncIs(r,s=[]){try{let i;const n=this,a=function(a,o,u){var l=[];for(var h in a)l.push(h);return function(r,s,i){var n,a,o=-1;return function u(l){try{for(;++o<r.length&&(!i||!i());)if((l=s(o))&&l.then){if(!((h=l)instanceof t&&1&h.s))return void l.then(u,a||(a=e.bind(null,n=new t,2)));l=l.v}n?e(n,1,l):n=l}catch(r){e(n||(n=new t),2,r)}var h}(),n}(l,function(e){return t=l[e],Promise.resolve(n[`is${s[t][1]}`].apply(n,[r,s[t][2].join(":")])).then(function(e){return function(){if(!e)return Promise.resolve(s[t][0]).then(function(e){return i=1,e})}()});var t},function(){return i})}(s=n._prepare(r,s));return Promise.resolve(a&&a.then?a.then(function(e){return!i||e}):!i||a)}catch(e){return Promise.reject(e)}}asyncIsValid(e,t=[]){try{return Promise.resolve(this.asyncIs(e,t)).then(function(e){return!0===e})}catch(e){return Promise.reject(e)}}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let n=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(n)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let a=[null,void 0,""].includes(r)?this.messages[n]:this.messages[n].replace("[PARAM]",r);return[null,void 0,""].includes(s)?a.replace("[FIELD]",this.defaultFieldName):a.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}"undefined"!=typeof window&&(window.Iodine=new r),exports.Iodine=r;
//# sourceMappingURL=iodine.min.js.map

@@ -1,2 +0,2 @@

class e{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(t,r){e.prototype[`is${this._titleCase(t)}`]=r}async asyncIs(e,t=[]){for(let r in t=this._prepare(e,t))if(!await this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return await t[r][0];return!0}async asyncIsValid(e,t=[]){return!0===await this.asyncIs(e,t)}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let a=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(a)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let n=[null,void 0,""].includes(r)?this.messages[a]:this.messages[a].replace("[PARAM]",r);return[null,void 0,""].includes(s)?n.replace("[FIELD]",this.defaultFieldName):n.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}window.Iodine=new e;export{e as Iodine};
class e{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(t,r){e.prototype[`is${this._titleCase(t)}`]=r}async asyncIs(e,t=[]){for(let r in t=this._prepare(e,t))if(!await this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return await t[r][0];return!0}async asyncIsValid(e,t=[]){return!0===await this.asyncIs(e,t)}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let a=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(a)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let n=[null,void 0,""].includes(r)?this.messages[a]:this.messages[a].replace("[PARAM]",r);return[null,void 0,""].includes(s)?n.replace("[FIELD]",this.defaultFieldName):n.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}"undefined"!=typeof window&&(window.Iodine=new e);export{e as Iodine};
//# sourceMappingURL=iodine.min.modern.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).iodine={})}(this,function(e){function t(e,s,i){if(!e.s){if(i instanceof r){if(!i.s)return void(i.o=t.bind(null,e,s));1&s&&(s=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,e,s),t.bind(null,e,2));e.s=s,e.v=i;const n=e.o;n&&n(e)}}const r=function(){function e(){}return e.prototype.then=function(r,s){const i=new e,n=this.s;if(n){const e=1&n?r:s;if(e){try{t(i,1,e(this.v))}catch(e){t(i,2,e)}return i}return this}return this.o=function(e){try{const n=e.v;1&e.s?t(i,1,r?r(n):n):s?t(i,1,s(n)):t(i,2,n)}catch(e){t(i,2,e)}},i},e}();class s{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(e,t){s.prototype[`is${this._titleCase(e)}`]=t}asyncIs(e,s=[]){try{let i;const n=this,a=function(a,o,u){var l=[];for(var f in a)l.push(f);return function(e,s,i){var n,a,o=-1;return function u(l){try{for(;++o<e.length&&(!i||!i());)if((l=s(o))&&l.then){if(!((f=l)instanceof r&&1&f.s))return void l.then(u,a||(a=t.bind(null,n=new r,2)));l=l.v}n?t(n,1,l):n=l}catch(e){t(n||(n=new r),2,e)}var f}(),n}(l,function(t){return r=l[t],Promise.resolve(n[`is${s[r][1]}`].apply(n,[e,s[r][2].join(":")])).then(function(e){return function(){if(!e)return i=1,Promise.resolve(s[r][0])}()});var r},function(){return i})}(s=n._prepare(e,s));return Promise.resolve(a&&a.then?a.then(function(e){return!i||e}):!i||a)}catch(e){return Promise.reject(e)}}asyncIsValid(e,t=[]){try{return Promise.resolve(this.asyncIs(e,t)).then(function(e){return!0===e})}catch(e){return Promise.reject(e)}}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let n=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(n)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let a=[null,void 0,""].includes(r)?this.messages[n]:this.messages[n].replace("[PARAM]",r);return[null,void 0,""].includes(s)?a.replace("[FIELD]",this.defaultFieldName):a.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}window.Iodine=new s,e.Iodine=s});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).iodine={})}(this,function(e){function t(e,s,i){if(!e.s){if(i instanceof r){if(!i.s)return void(i.o=t.bind(null,e,s));1&s&&(s=i.s),i=i.v}if(i&&i.then)return void i.then(t.bind(null,e,s),t.bind(null,e,2));e.s=s,e.v=i;const n=e.o;n&&n(e)}}const r=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(r,s){const i=new e,n=this.s;if(n){const e=1&n?r:s;if(e){try{t(i,1,e(this.v))}catch(e){t(i,2,e)}return i}return this}return this.o=function(e){try{const n=e.v;1&e.s?t(i,1,r?r(n):n):s?t(i,1,s(n)):t(i,2,n)}catch(e){t(i,2,e)}},i},e}();class s{constructor(){this.locale=void 0,this.messages=this._defaultMessages(),this.defaultFieldName="Value"}_dateCompare(e,t,r,s=!1){return!!this.isDate(e)&&!(!this.isDate(t)&&!this.isInteger(t))&&(t="number"==typeof t?t:t.getTime(),"less"===r&&s?e.getTime()<=t:"less"!==r||s?"more"===r&&s?e.getTime()>=t:"more"!==r||s?void 0:e.getTime()>t:e.getTime()<t)}_defaultMessages(){return{after:"The date must be after: '[PARAM]'",afterOrEqual:"The date must be after or equal to: '[PARAM]'",array:"[FIELD] must be an array",before:"The date must be before: '[PARAM]'",beforeOrEqual:"The date must be before or equal to: '[PARAM]'",boolean:"[FIELD] must be true or false",date:"[FIELD] must be a date",different:"[FIELD] must be different to '[PARAM]'",endingWith:"[FIELD] must end with '[PARAM]'",email:"[FIELD] must be a valid email address",falsy:"[FIELD] must be a falsy value (false, 'false', 0 or '0')",in:"[FIELD] must be one of the following options: [PARAM]",integer:"[FIELD] must be an integer",json:"[FIELD] must be a parsable JSON object string",max:"[FIELD] must be less than or equal to [PARAM]",min:"[FIELD] must be greater than or equal to [PARAM]",maxLength:"[FIELD] must not be greater than '[PARAM]' in character length",minLength:"[FIELD] must not be less than '[PARAM]' character length",notIn:"[FIELD] must not be one of the following options: [PARAM]",numeric:"[FIELD] must be numeric",optional:"[FIELD] is optional",regexMatch:"[FIELD] must satisify the regular expression: [PARAM]",required:"[FIELD] must be present",same:"[FIELD] must be '[PARAM]'",startingWith:"[FIELD] must start with '[PARAM]'",string:"[FIELD] must be a string",truthy:"[FIELD] must be a truthy value (true, 'true', 1 or '1')",url:"[FIELD] must be a valid url",uuid:"[FIELD] must be a valid UUID"}}_prepare(e,t=[]){return t.length?"optional"===t[0]&&this.isOptional(e)?[]:t.filter(e=>"optional"!==e).map(e=>[e,this._titleCase(e.split(":").shift()),e.split(":").slice(1)]):[]}_titleCase(e){return`${e[0].toUpperCase()}${e.slice(1)}`}addRule(e,t){s.prototype[`is${this._titleCase(e)}`]=t}asyncIs(e,s=[]){try{let i;const n=this,a=function(a,o,u){var l=[];for(var f in a)l.push(f);return function(e,s,i){var n,a,o=-1;return function u(l){try{for(;++o<e.length&&(!i||!i());)if((l=s(o))&&l.then){if(!((f=l)instanceof r&&1&f.s))return void l.then(u,a||(a=t.bind(null,n=new r,2)));l=l.v}n?t(n,1,l):n=l}catch(e){t(n||(n=new r),2,e)}var f}(),n}(l,function(t){return r=l[t],Promise.resolve(n[`is${s[r][1]}`].apply(n,[e,s[r][2].join(":")])).then(function(e){return function(){if(!e)return Promise.resolve(s[r][0]).then(function(e){return i=1,e})}()});var r},function(){return i})}(s=n._prepare(e,s));return Promise.resolve(a&&a.then?a.then(function(e){return!i||e}):!i||a)}catch(e){return Promise.reject(e)}}asyncIsValid(e,t=[]){try{return Promise.resolve(this.asyncIs(e,t)).then(function(e){return!0===e})}catch(e){return Promise.reject(e)}}getErrorMessage(e,t){let{param:r,field:s}="object"==typeof t?t:{param:t,field:void 0};const i=e.split(":");let n=i.shift();r=r||i.join(":"),["after","afterOrEqual","before","beforeOrEqual"].includes(n)&&(r=new Date(parseInt(r)).toLocaleTimeString(this.locale,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"numeric",hour12:!1}));let a=[null,void 0,""].includes(r)?this.messages[n]:this.messages[n].replace("[PARAM]",r);return[null,void 0,""].includes(s)?a.replace("[FIELD]",this.defaultFieldName):a.replace("[FIELD]",s)}isAfter(e,t){return this._dateCompare(e,t,"more",!1)}isAfterOrEqual(e,t){return this._dateCompare(e,t,"more",!0)}isArray(e){return Array.isArray(e)}isBefore(e,t){return this._dateCompare(e,t,"less",!1)}isBeforeOrEqual(e,t){return this._dateCompare(e,t,"less",!0)}isBoolean(e){return[!0,!1].includes(e)}isDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}isDifferent(e,t){return e!=t}isEndingWith(e,t){return this.isString(e)&&e.endsWith(t)}isEmail(e){return new RegExp("^\\S+@\\S+[\\.][0-9a-z]+$").test(String(e).toLowerCase())}isFalsy(e){return[0,"0",!1,"false"].includes(e)}isIn(e,t){return("string"==typeof t?t.split(","):t).includes(e)}isInteger(e){return Number.isInteger(e)&&parseInt(e).toString()===e.toString()}isJson(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}isMax(e,t){return parseFloat(e)<=t}isMin(e,t){return parseFloat(e)>=t}isMaxLength(e,t){return"string"==typeof e&&e.length<=t}isMinLength(e,t){return"string"==typeof e&&e.length>=t}isNotIn(e,t){return!this.isIn(e,t)}isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}isOptional(e){return[null,void 0,""].includes(e)}isRegexMatch(e,t){return new RegExp(t).test(String(e))}isRequired(e){return!this.isOptional(e)}isSame(e,t){return e==t}isStartingWith(e,t){return this.isString(e)&&e.startsWith(t)}isString(e){return"string"==typeof e}isTruthy(e){return[1,"1",!0,"true"].includes(e)}isUrl(e){return new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$").test(String(e).toLowerCase())}isUuid(e){return new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$").test(String(e).toLowerCase())}is(e,t=[]){for(let r in t=this._prepare(e,t))if(!this[`is${t[r][1]}`].apply(this,[e,t[r][2].join(":")]))return t[r][0];return!0}isValid(e,t=[]){return!0===this.is(e,t)}setErrorMessages(e){this.messages=e}setErrorMessage(e,t){this.messages[e]=t}setLocale(e){this.locale=e}setDefaultFieldName(e){this.defaultFieldName=e}}"undefined"!=typeof window&&(window.Iodine=new s),e.Iodine=s});
//# sourceMappingURL=iodine.min.umd.js.map
{
"name": "@kingshott/iodine",
"version": "7.0.0",
"version": "7.0.1",
"description": "A micro client-side validation library",

@@ -26,12 +26,12 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"babel-jest": "^26.6.3",
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"babel-jest": "^27.4.2",
"braces": "^3.0.2",
"jest": "^26.6.3",
"js-yaml": "^4.0.0",
"microbundle": "^0.13.0",
"prettier": "^2.2.1",
"serialize-javascript": "^5.0.1"
"jest": "^27.4.3",
"js-yaml": "^4.1.0",
"microbundle": "^0.14.2",
"prettier": "^2.5.0",
"serialize-javascript": "^6.0.0"
}
}

@@ -16,3 +16,3 @@ <!-- Screenshot -->

Iodine.js is a micro client-side validation library. It has no dependencies and can be used in isolation or as part of a framework. Iodine also supports chainable rules, allowing you to verify that a piece of data satisifies multiple criteria.
Iodine.js is a micro client-side validation library. It has no dependencies and can be used in isolation or as part of a framework. Iodine also supports chainable rules, allowing you to verify that a piece of data satisfies multiple criteria.

@@ -228,7 +228,7 @@ ## Installation

| isMax(limit) | Verify that the item's numerical value does not exceed the given limit
| isMin(limit) | Verify that the item's numberical value is not under the given limit
| isMin(limit) | Verify that the item's numerical value is not under the given limit
| isNotIn(array) | Verify that the item is not within the given `array`
| isNumeric | Verify that the item is `number` or a numeric `string`
| isOptional | Allow for optional values (only for use with multiple checks)
| isRegexMatch(exp) | Verify that the item satisifies the given regular expression
| isRegexMatch(exp) | Verify that the item satisfies the given regular expression
| isRequired | Verify that the item is not `null`, `undefined` or an empty `string`

@@ -235,0 +235,0 @@ | isSame(value) | Verify that the item is the same as the supplied value (uses loose compare)

@@ -450,2 +450,3 @@ /*

* Replace the default field name with a new value.
*
*/

@@ -461,2 +462,4 @@ setDefaultFieldName(fieldName) {

*/
window.Iodine = new Iodine();
if(typeof window !== 'undefined') {
window.Iodine = new Iodine();
}

@@ -0,1 +1,6 @@

/**
* @jest-environment jsdom
*
*/
import { Iodine as Library } from '../src/iodine';

@@ -2,0 +7,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc