abolish-browser
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -1,1 +0,1 @@ | ||
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,(function(r){var n=e[i][1][r];return o(n||r)}),p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){const{Abolish:Abolish,Rule:Rule}=require("abolish");window.Abolish=Abolish;window.AbolishRule=Rule},{abolish:2}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});const Abolish=require("./src/Abolish");exports.Abolish=Abolish;const Functions_1=require("./src/Functions");exports.Rule=Functions_1.Rule},{"./src/Abolish":3,"./src/Functions":5}],3:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};const StringToRules_1=__importDefault(require("./StringToRules"));const GlobalValidators_1=__importDefault(require("./GlobalValidators"));const Functions_1=require("./Functions");const AbolishError_1=__importDefault(require("./AbolishError"));const ObjectModifier_1=__importDefault(require("./ObjectModifier"));class Abolish{constructor(){this.validators={}}static addGlobalValidator(validator){if(typeof validator==="object"&&!Array.isArray(validator)){if(!validator.error)validator.error=`:param failed {${validator.name}} validation.`;GlobalValidators_1.default[validator.name]=validator}else{throw new TypeError("addGlobalValidator argument must be an object.")}}static addGlobalValidators(validators){if(Array.isArray(validators)){for(const value of validators){Abolish.addGlobalValidator(value)}}else{throw new TypeError("addGlobalValidators argument must be an array")}}addValidator(validator){if(typeof validator==="object"&&!Array.isArray(validator)){if(!validator.error)validator.error=`:param failed {${validator.name}} validation.`;this.validators[validator.name]=validator}else{throw new TypeError("addValidator argument must be an object.")}return this}addValidators(validators){if(Array.isArray(validators)){for(const value of validators){this.addValidator(value)}}else{throw new TypeError("addValidators argument must be an array")}return this}static validate(object,rules){return(new this).validate(object,rules)}static validateAsync(object,rules){return(new this).validateAsync(object,rules)}validate(object,rules,isAsync=false){let asyncData={validated:{},jobs:[]};let internalWildcardRules={};if(rules.hasOwnProperty("*")){internalWildcardRules=rules["*"];delete rules["*"];if(typeof internalWildcardRules==="string")internalWildcardRules=StringToRules_1.default(internalWildcardRules)}let validated=Object.assign({},object);const keysToBeValidated=Object.keys(rules);for(const rule of keysToBeValidated){let ruleData=rules[rule];if(ruleData==="*")ruleData={};if(typeof ruleData==="string")ruleData=StringToRules_1.default(ruleData);let $skip=false;if(ruleData.hasOwnProperty("$skip")){$skip=ruleData["$skip"];delete ruleData["$skip"];if(typeof $skip==="function"){$skip=$skip(validated[rule])}if(typeof $skip!=="boolean"){throw new Error(`$skip value or resolved function value must be a BOOLEAN in RuleFor: (${rule})`)}}if(!$skip){let $name=false;if(ruleData.hasOwnProperty("$name")){$name=ruleData["$name"];delete ruleData["$name"];if(typeof $name!=="string"){throw new Error(`$skip value or resolved function value must be a BOOLEAN in RuleFor: (${rule})`)}}let $error=false;if(ruleData.hasOwnProperty("$error")){$error=ruleData["$error"];delete ruleData["$error"];if(!$error||typeof $error!=="string"){throw new Error(`$error value must be a STRING in RuleFor: (${rule})`)}}ruleData=Object.assign(Object.assign({},internalWildcardRules),ruleData);for(const validatorName of Object.keys(ruleData)){if(!this.validators.hasOwnProperty(validatorName)&&!GlobalValidators_1.default.hasOwnProperty(validatorName)){throw new Error(`Validator: {${validatorName}} does not exists but defined in rules`)}const validator=this.validators[validatorName]||GlobalValidators_1.default[validatorName];if(!isAsync&&validator.isAsync){throw new Error(`Validator: {${validatorName}} is async, use validateAsync method instead.`)}const validatorOption=ruleData[validatorName];const objectValue=validated[rule];if(isAsync){asyncData.jobs.push({$name:$name,rule:rule,validator:validator,validatorName:validatorName,validatorOption:validatorOption,$error:$error})}else{let validationResult=false;try{validationResult=validator.validator(objectValue,validatorOption,{error:(message,data)=>new AbolishError_1.default(message,data),modifier:new ObjectModifier_1.default(validated,rule)})}catch(e){return{error:{key:rule,type:"internal",validator:validatorName,message:e.message,data:e.stack}}}if(validationResult instanceof AbolishError_1.default){return{error:{key:rule,type:"validator",validator:validatorName,message:$error?$error:validationResult.message,data:validationResult.data}}}else if(validationResult===false){const optionIsStringable=typeof validatorOption==="string"||typeof validatorOption==="number";let message=($error?$error:validator.error).replace(":param",$name?$name:Functions_1.StartCase(rule));if(optionIsStringable)message=message.replace(":option",validatorOption);return{error:{key:rule,type:"validator",validator:validatorName,message:message,data:null}}}}}}}if(isAsync){asyncData.validated=validated;return asyncData}validated=Functions_1.Pick(validated,keysToBeValidated);return{error:false,validated:validated}}validateAsync(object,rules){const asyncData=this.validate(object,rules,true);const{validated:validated,jobs:jobs}=asyncData;const keysToBeValidated=Object.keys(rules);return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){for(const job of jobs){const{$name:$name,rule:rule,validator:validator,validatorName:validatorName,validatorOption:validatorOption,$error:$error}=job;const objectValue=validated[rule];let validationResult=false;try{validationResult=yield validator.validator(objectValue,validatorOption,{error:(message,data)=>new AbolishError_1.default(message,data),modifier:new ObjectModifier_1.default(validated,rule)})}catch(e){return resolve({error:{key:rule,type:"internal",validator:validatorName,message:e.message,data:e.stack}})}if(validationResult instanceof AbolishError_1.default){return resolve({error:{key:rule,type:"validator",validator:validatorName,message:$error?$error:validationResult.message,data:validationResult.data}})}else if(validationResult!==false){const optionIsStringable=typeof validatorOption==="string"||typeof validatorOption==="number";let message=($error?$error:validator.error).replace(":param",$name?$name:Functions_1.StartCase(rule));if(optionIsStringable)message=message.replace(":option",validatorOption);return resolve({error:{key:rule,type:"validator",validator:validatorName,message:message,data:null}})}}return resolve({error:false,validated:Functions_1.Pick(validated,keysToBeValidated)})})))}}module.exports=Abolish},{"./AbolishError":4,"./Functions":5,"./GlobalValidators":6,"./ObjectModifier":7,"./StringToRules":8}],4:[function(require,module,exports){"use strict";class AbolishError{constructor(message,data){this.message=message;if(data){this.data=data}else{this.data={}}return this}setData(data){this.data=data;return data}}module.exports=AbolishError},{}],5:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:true});const StringToRules_1=__importDefault(require("./StringToRules"));function UpperFirst(str){return str[0].toUpperCase()+str.substr(1)}exports.UpperFirst=UpperFirst;function StartCase(str){if(str.indexOf("_")>=0)str=str.replace("_"," ");if(str.indexOf("-")>=0)str=str.replace("-"," ");return str.split(" ").map(word=>UpperFirst(word)).join(" ")}exports.StartCase=StartCase;function Rule(rules){if(!Array.isArray(rules)){rules=[rules]}let generatedRule={};for(let rule of rules){if(typeof rule==="string")rule=StringToRules_1.default(rule);generatedRule=Object.assign(Object.assign({},generatedRule),rule)}return generatedRule}exports.Rule=Rule;function Pick(object,keys){return keys.reduce((obj,key)=>{if(object&&object.hasOwnProperty(key)){obj[key]=object[key]}return obj},{})}exports.Pick=Pick;function Set(object,path,value){if(Object(object)!==object)return object;if(!Array.isArray(path))path=path.toString().match(/[^.[\]]+/g)||[];path.slice(0,-1).reduce((a,c,i)=>Object(a[c])===a[c]?a[c]:a[c]=Math.abs(path[i+1])>>0===+path[i+1]?[]:{},object)[path[path.length-1]]=value;return object}exports.Set=Set;function Get(obj,path,defaultValue){const travel=regexp=>String.prototype.split.call(path,regexp).filter(Boolean).reduce((res,key)=>res!==null&&res!==undefined?res[key]:res,obj);const result=travel(/[,[\]]+?/)||travel(/[,[\].]+?/);return result===undefined||result===obj?defaultValue:result}exports.Get=Get},{"./StringToRules":8}],6:[function(require,module,exports){"use strict";function trimIfString(value){return typeof value==="string"?value.trim():value}const GlobalValidators={must:{name:"must",error:":param is required.",validator:(value,option)=>{if(!option){return true}if(typeof value==="undefined"||value===null){return false}else if(typeof value==="string"||Array.isArray(value)){return value.length>0}return true}},typeof:{name:"typeof",error:":param is not typeOf :option",validator:(value,option)=>{if(option===false)return true;option=option.toLowerCase();if(option==="array")return Array.isArray(value);return typeof value===option}},exact:{name:"exact",validator:(value,option)=>value===option,error:":param failed exact validator"},min:{name:"min",error:":param is too small. (Min. :option)",validator:(value,option)=>{const isNotNumber=isNaN(value);if(typeof value==="string"&&isNotNumber||Array.isArray(value))return GlobalValidators.minLength.validator(value,option);if(isNotNumber)return false;return Number(value)>=Number(option)}},max:{name:"max",error:":param is too big. (Max. :option)",validator:(value,option)=>{const isNotNumber=isNaN(value);if(typeof value==="string"&&isNotNumber||Array.isArray(value))return GlobalValidators.maxLength.validator(value,option);if(isNotNumber)return false;return Number(value)<=Number(option)}},minLength:{name:"minLength",error:":param is too short. (Min. :option characters)",validator:(value,option)=>{if(typeof value!=="string"&&!Array.isArray(value))return false;value=trimIfString(value);return value.length>=Number(option)}},maxLength:{name:"maxLength",error:":param is too long. (Max. :option characters)",validator:(value,option)=>{if(typeof value!=="string"&&!Array.isArray(value))return false;value=trimIfString(value);return value.length<=Number(option)}},selectMin:{name:"selectMin",error:"Select at-least :option :param.",validator:(value,option)=>GlobalValidators.minLength.validator(value,option)},selectMax:{name:"selectMax",error:"Select at-most :option :param.",validator:(value,option)=>GlobalValidators.maxLength.validator(value,option)}};module.exports=GlobalValidators},{}],7:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};const Functions_1=require("./Functions");const lodash_has_1=__importDefault(require("lodash.has"));const lodash_unset_1=__importDefault(require("lodash.unset"));class ObjectModifier{constructor(data,param){this.data=data;this.path=param;return this}get(path,$default=undefined){return Functions_1.Get(this.data,path,$default)}has(path){return lodash_has_1.default(this.data,path)}set(path,value){return Functions_1.Set(this.data,path,value)}setThis(value){return this.set(this.path,value)}unset(path){return lodash_unset_1.default(this.data,path)}unsetThis(){return lodash_unset_1.default(this.data,this.path)}}module.exports=ObjectModifier},{"./Functions":5,"lodash.has":9,"lodash.unset":10}],8:[function(require,module,exports){"use strict";const onlyKey=new RegExp(/([!a-zA-Z_*0-9]+)/g);const keyColumnVal=new RegExp(/([a-zA-Z_*0-9]+:[a-zA-Z_0-9]+)/g);const keyColumnValStringDoubleQuotes=new RegExp(/([a-zA-Z_*0-9]+:"[^"]+")/g);const keyColumnValStringSingleQuotes=new RegExp(/([a-zA-Z_*0-9]+:'[^']+')/g);const keyColumnValStringGraveAccent=new RegExp(/([a-zA-Z_*0-9]+:`[^`]+`)/g);const StringToRules=str=>{let s=str.split("|");const keyColumnValObj={};for(let i=0;i<s.length;i++){const pair=s[i];if(pair.match(keyColumnValStringSingleQuotes)||pair.match(keyColumnValStringDoubleQuotes)||pair.match(keyColumnValStringGraveAccent)){const[key,...value]=pair.split(":");let valueToString=value.join(":");valueToString=valueToString.substr(1);valueToString=valueToString.substr(0,value.length-1);keyColumnValObj[key]=valueToString}else if(pair.match(keyColumnVal)){let[key,value]=pair.split(":");if(!isNaN(value)){value=Number(value)}keyColumnValObj[key]=value}else if(pair.match(onlyKey)){let key=pair;let value=true;if(key.substr(0,1)==="!"){key=key.substr(1);value=false}keyColumnValObj[key]=value}}return keyColumnValObj};module.exports=StringToRules},{}],9:[function(require,module,exports){(function(global){var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991;var argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reEscapeChar=/\\(\\)?/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var reIsUint=/^(?:0|[1-9]\d*)$/;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();function getValue(object,key){return object==null?undefined:object[key]}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=root["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var objectToString=objectProto.toString;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Symbol=root.Symbol,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice;var Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var symbolProto=Symbol?Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function Hash(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key)["delete"](key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){getMapData(this,key).set(key,value);return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key)}function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseToString(value){if(typeof value=="string"){return value}if(isSymbol(value)){return symbolToString?symbolToString.call(value):""}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function castPath(value){return isArray(value)?value:stringToPath(value)}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function hasPath(object,path,hasFunc){path=isKey(path,object)?[path]:castPath(path);var result,index=-1,length=path.length;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key))){break}object=object[key]}if(result){return result}var length=object?object.length:0;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object))}function isIndex(value,length){length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(typeof value=="number"||reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}function isKey(value,object){if(isArray(value)){return false}var type=typeof value;if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)){return true}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var stringToPath=memoize((function(string){string=toString(string);var result=[];if(reLeadingDot.test(string)){result.push("")}string.replace(rePropName,(function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}));return result}));function toKey(value){if(typeof value=="string"||isSymbol(value)){return value}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function memoize(func,resolver){if(typeof func!="function"||resolver&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result);return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function eq(value,other){return value===other||value!==value&&other!==other}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}var isArray=Array.isArray;function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toString(value){return value==null?"":baseToString(value)}function has(object,path){return object!=null&&hasPath(object,path,baseHas)}module.exports=has}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],10:[function(require,module,exports){(function(global){var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var INFINITY=1/0;var funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reEscapeChar=/\\(\\)?/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();function getValue(object,key){return object==null?undefined:object[key]}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=root["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var objectToString=objectProto.toString;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Symbol=root.Symbol,splice=arrayProto.splice;var Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var symbolProto=Symbol?Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function Hash(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key)["delete"](key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){getMapData(this,key).set(key,value);return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}function baseGet(object,path){path=isKey(path,object)?[path]:castPath(path);var index=0,length=path.length;while(object!=null&&index<length){object=object[toKey(path[index++])]}return index&&index==length?object:undefined}function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0){start=-start>length?0:length+start}end=end>length?length:end;if(end<0){end+=length}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length){result[index]=array[index+start]}return result}function baseToString(value){if(typeof value=="string"){return value}if(isSymbol(value)){return symbolToString?symbolToString.call(value):""}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function baseUnset(object,path){path=isKey(path,object)?[path]:castPath(path);object=parent(object,path);var key=toKey(last(path));return!(object!=null&&hasOwnProperty.call(object,key))||delete object[key]}function castPath(value){return isArray(value)?value:stringToPath(value)}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function isKey(value,object){if(isArray(value)){return false}var type=typeof value;if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)){return true}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}function parent(object,path){return path.length==1?object:baseGet(object,baseSlice(path,0,-1))}var stringToPath=memoize((function(string){string=toString(string);var result=[];if(reLeadingDot.test(string)){result.push("")}string.replace(rePropName,(function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}));return result}));function toKey(value){if(typeof value=="string"||isSymbol(value)){return value}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function memoize(func,resolver){if(typeof func!="function"||resolver&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result);return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function eq(value,other){return value===other||value!==value&&other!==other}var isArray=Array.isArray;function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toString(value){return value==null?"":baseToString(value)}function unset(object,path){return object==null?true:baseUnset(object,path)}module.exports=unset}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]); | ||
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,(function(r){var n=e[i][1][r];return o(n||r)}),p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){const{Abolish:Abolish,Rule:Rule}=require("abolish");window.Abolish=Abolish;window.AbolishRule=Rule},{abolish:2}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});const Abolish=require("./src/Abolish");exports.Abolish=Abolish;const Functions_1=require("./src/Functions");exports.Rule=Functions_1.Rule},{"./src/Abolish":3,"./src/Functions":5}],3:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P((function(resolve){resolve(value)}))}return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))};var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};const StringToRules_1=__importDefault(require("./StringToRules"));const GlobalValidators_1=__importDefault(require("./GlobalValidators"));const Functions_1=require("./Functions");const AbolishError_1=__importDefault(require("./AbolishError"));const ObjectModifier_1=__importDefault(require("./ObjectModifier"));class Abolish{constructor(){this.validators={}}static addGlobalValidator(validator){if(typeof validator==="object"&&!Array.isArray(validator)){if(!validator.error)validator.error=`:param failed {${validator.name}} validation.`;GlobalValidators_1.default[validator.name]=validator}else{throw new TypeError("addGlobalValidator argument must be an object.")}}static addGlobalValidators(validators){if(Array.isArray(validators)){for(const value of validators){Abolish.addGlobalValidator(value)}}else{throw new TypeError("addGlobalValidators argument must be an array")}}addValidator(validator){if(typeof validator==="object"&&!Array.isArray(validator)){if(!validator.error)validator.error=`:param failed {${validator.name}} validation.`;this.validators[validator.name]=validator}else{throw new TypeError("addValidator argument must be an object.")}return this}addValidators(validators){if(Array.isArray(validators)){for(const value of validators){this.addValidator(value)}}else{throw new TypeError("addValidators argument must be an array")}return this}static validate(object,rules){return(new this).validate(object,rules)}static validateAsync(object,rules){return(new this).validateAsync(object,rules)}validate(object,rules,isAsync=false){let asyncData={validated:{},jobs:[]};let internalWildcardRules={};if(rules.hasOwnProperty("*")){internalWildcardRules=rules["*"];delete rules["*"];if(typeof internalWildcardRules==="string")internalWildcardRules=StringToRules_1.default(internalWildcardRules)}let validated=Object.assign({},object);const keysToBeValidated=Object.keys(rules);for(const rule of keysToBeValidated){let ruleData=rules[rule];if(ruleData==="*")ruleData={};if(typeof ruleData==="string")ruleData=StringToRules_1.default(ruleData);let $skip=false;if(ruleData.hasOwnProperty("$skip")){$skip=ruleData["$skip"];delete ruleData["$skip"];if(typeof $skip==="function"){$skip=$skip(validated[rule])}if(typeof $skip!=="boolean"){throw new Error(`$skip value or resolved function value must be a BOOLEAN in RuleFor: (${rule})`)}}if(!$skip){let $name=false;if(ruleData.hasOwnProperty("$name")){$name=ruleData["$name"];delete ruleData["$name"];if(typeof $name!=="string"){throw new Error(`$skip value or resolved function value must be a BOOLEAN in RuleFor: (${rule})`)}}let $error=false;if(ruleData.hasOwnProperty("$error")){$error=ruleData["$error"];delete ruleData["$error"];if(!$error||typeof $error!=="string"){throw new Error(`$error value must be a STRING in RuleFor: (${rule})`)}}ruleData=Object.assign(Object.assign({},internalWildcardRules),ruleData);for(const validatorName of Object.keys(ruleData)){if(!this.validators.hasOwnProperty(validatorName)&&!GlobalValidators_1.default.hasOwnProperty(validatorName)){throw new Error(`Validator: {${validatorName}} does not exists but defined in rules`)}const validator=this.validators[validatorName]||GlobalValidators_1.default[validatorName];if(!isAsync&&validator.isAsync){throw new Error(`Validator: {${validatorName}} is async, use validateAsync method instead.`)}const validatorOption=ruleData[validatorName];const objectValue=validated[rule];if(isAsync){asyncData.jobs.push({$name:$name,rule:rule,validator:validator,validatorName:validatorName,validatorOption:validatorOption,$error:$error})}else{let validationResult=false;try{validationResult=validator.validator(objectValue,validatorOption,{error:(message,data)=>new AbolishError_1.default(message,data),modifier:new ObjectModifier_1.default(validated,rule)})}catch(e){return{error:{key:rule,type:"internal",validator:validatorName,message:e.message,data:e.stack}}}if(validationResult instanceof AbolishError_1.default){return{error:{key:rule,type:"validator",validator:validatorName,message:$error?$error:validationResult.message,data:validationResult.data}}}else if(validationResult===false){const optionIsStringable=typeof validatorOption==="string"||typeof validatorOption==="number";let message=($error?$error:validator.error).replace(":param",$name?$name:Functions_1.StartCase(rule));if(optionIsStringable)message=message.replace(":option",validatorOption);return{error:{key:rule,type:"validator",validator:validatorName,message:message,data:null}}}}}}}if(isAsync){asyncData.validated=validated;return asyncData}validated=Functions_1.Pick(validated,keysToBeValidated);return{error:false,validated:validated}}validateAsync(object,rules){const asyncData=this.validate(object,rules,true);const{validated:validated,jobs:jobs}=asyncData;const keysToBeValidated=Object.keys(rules);return new Promise(resolve=>__awaiter(this,void 0,void 0,(function*(){for(const job of jobs){const{$name:$name,rule:rule,validator:validator,validatorName:validatorName,validatorOption:validatorOption,$error:$error}=job;const objectValue=validated[rule];let validationResult=false;try{validationResult=yield validator.validator(objectValue,validatorOption,{error:(message,data)=>new AbolishError_1.default(message,data),modifier:new ObjectModifier_1.default(validated,rule)})}catch(e){return resolve({error:{key:rule,type:"internal",validator:validatorName,message:e.message,data:e.stack}})}if(validationResult instanceof AbolishError_1.default){return resolve({error:{key:rule,type:"validator",validator:validatorName,message:$error?$error:validationResult.message,data:validationResult.data}})}else if(validationResult===false){const optionIsStringable=typeof validatorOption==="string"||typeof validatorOption==="number";let message=($error?$error:validator.error).replace(":param",$name?$name:Functions_1.StartCase(rule));if(optionIsStringable)message=message.replace(":option",validatorOption);return resolve({error:{key:rule,type:"validator",validator:validatorName,message:message,data:null}})}}return resolve({error:false,validated:Functions_1.Pick(validated,keysToBeValidated)})})))}}module.exports=Abolish},{"./AbolishError":4,"./Functions":5,"./GlobalValidators":6,"./ObjectModifier":7,"./StringToRules":8}],4:[function(require,module,exports){"use strict";class AbolishError{constructor(message,data){this.message=message;if(data){this.data=data}else{this.data={}}return this}setData(data){this.data=data;return data}}module.exports=AbolishError},{}],5:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:true});const StringToRules_1=__importDefault(require("./StringToRules"));function UpperFirst(str){return str[0].toUpperCase()+str.substr(1)}exports.UpperFirst=UpperFirst;function StartCase(str){if(str.indexOf("_")>=0)str=str.replace("_"," ");if(str.indexOf("-")>=0)str=str.replace("-"," ");return str.split(" ").map(word=>UpperFirst(word)).join(" ")}exports.StartCase=StartCase;function Rule(rules){if(!Array.isArray(rules)){rules=[rules]}let generatedRule={};for(let rule of rules){if(typeof rule==="string")rule=StringToRules_1.default(rule);generatedRule=Object.assign(Object.assign({},generatedRule),rule)}return generatedRule}exports.Rule=Rule;function Pick(object,keys){return keys.reduce((obj,key)=>{if(object&&object.hasOwnProperty(key)){obj[key]=object[key]}return obj},{})}exports.Pick=Pick;function Set(object,path,value){if(Object(object)!==object)return object;if(!Array.isArray(path))path=path.toString().match(/[^.[\]]+/g)||[];path.slice(0,-1).reduce((a,c,i)=>Object(a[c])===a[c]?a[c]:a[c]=Math.abs(path[i+1])>>0===+path[i+1]?[]:{},object)[path[path.length-1]]=value;return object}exports.Set=Set;function Get(obj,path,defaultValue){const travel=regexp=>String.prototype.split.call(path,regexp).filter(Boolean).reduce((res,key)=>res!==null&&res!==undefined?res[key]:res,obj);const result=travel(/[,[\]]+?/)||travel(/[,[\].]+?/);return result===undefined||result===obj?defaultValue:result}exports.Get=Get},{"./StringToRules":8}],6:[function(require,module,exports){"use strict";function trimIfString(value){return typeof value==="string"?value.trim():value}const GlobalValidators={must:{name:"must",error:":param is required.",validator:(value,option)=>{if(!option){return true}if(typeof value==="undefined"||value===null){return false}else if(typeof value==="string"||Array.isArray(value)){return value.length>0}return true}},typeof:{name:"typeof",error:":param is not typeOf :option",validator:(value,option)=>{if(option===false)return true;option=option.toLowerCase();if(option==="array")return Array.isArray(value);return typeof value===option}},exact:{name:"exact",validator:(value,option)=>value===option,error:":param failed exact validator"},min:{name:"min",error:":param is too small. (Min. :option)",validator:(value,option)=>{const isNotNumber=isNaN(value);if(typeof value==="string"&&isNotNumber||Array.isArray(value))return GlobalValidators.minLength.validator(value,option);if(isNotNumber)return false;return Number(value)>=Number(option)}},max:{name:"max",error:":param is too big. (Max. :option)",validator:(value,option)=>{const isNotNumber=isNaN(value);if(typeof value==="string"&&isNotNumber||Array.isArray(value))return GlobalValidators.maxLength.validator(value,option);if(isNotNumber)return false;return Number(value)<=Number(option)}},minLength:{name:"minLength",error:":param is too short. (Min. :option characters)",validator:(value,option)=>{if(typeof value!=="string"&&!Array.isArray(value))return false;value=trimIfString(value);return value.length>=Number(option)}},maxLength:{name:"maxLength",error:":param is too long. (Max. :option characters)",validator:(value,option)=>{if(typeof value!=="string"&&!Array.isArray(value))return false;value=trimIfString(value);return value.length<=Number(option)}},selectMin:{name:"selectMin",error:"Select at-least :option :param.",validator:(value,option)=>GlobalValidators.minLength.validator(value,option)},selectMax:{name:"selectMax",error:"Select at-most :option :param.",validator:(value,option)=>GlobalValidators.maxLength.validator(value,option)}};module.exports=GlobalValidators},{}],7:[function(require,module,exports){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};const Functions_1=require("./Functions");const lodash_has_1=__importDefault(require("lodash.has"));const lodash_unset_1=__importDefault(require("lodash.unset"));class ObjectModifier{constructor(data,param){this.data=data;this.path=param;return this}get(path,$default=undefined){return Functions_1.Get(this.data,path,$default)}has(path){return lodash_has_1.default(this.data,path)}set(path,value){return Functions_1.Set(this.data,path,value)}setThis(value){return this.set(this.path,value)}unset(path){return lodash_unset_1.default(this.data,path)}unsetThis(){return lodash_unset_1.default(this.data,this.path)}}module.exports=ObjectModifier},{"./Functions":5,"lodash.has":9,"lodash.unset":10}],8:[function(require,module,exports){"use strict";const onlyKey=new RegExp(/([!a-zA-Z_*0-9]+)/g);const keyColumnVal=new RegExp(/([a-zA-Z_*0-9]+:[a-zA-Z_0-9]+)/g);const keyColumnValStringDoubleQuotes=new RegExp(/([a-zA-Z_*0-9]+:"[^"]+")/g);const keyColumnValStringSingleQuotes=new RegExp(/([a-zA-Z_*0-9]+:'[^']+')/g);const keyColumnValStringGraveAccent=new RegExp(/([a-zA-Z_*0-9]+:`[^`]+`)/g);const StringToRules=str=>{let s=str.split("|");const keyColumnValObj={};for(let i=0;i<s.length;i++){const pair=s[i];if(pair.match(keyColumnValStringSingleQuotes)||pair.match(keyColumnValStringDoubleQuotes)||pair.match(keyColumnValStringGraveAccent)){const[key,...value]=pair.split(":");let valueToString=value.join(":");valueToString=valueToString.substr(1);valueToString=valueToString.substr(0,value.length-1);keyColumnValObj[key]=valueToString}else if(pair.match(keyColumnVal)){let[key,value]=pair.split(":");if(!isNaN(value)){value=Number(value)}keyColumnValObj[key]=value}else if(pair.match(onlyKey)){let key=pair;let value=true;if(key.substr(0,1)==="!"){key=key.substr(1);value=false}keyColumnValObj[key]=value}}return keyColumnValObj};module.exports=StringToRules},{}],9:[function(require,module,exports){(function(global){var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991;var argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reEscapeChar=/\\(\\)?/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var reIsUint=/^(?:0|[1-9]\d*)$/;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();function getValue(object,key){return object==null?undefined:object[key]}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=root["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var objectToString=objectProto.toString;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Symbol=root.Symbol,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice;var Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var symbolProto=Symbol?Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function Hash(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key)["delete"](key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){getMapData(this,key).set(key,value);return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key)}function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseToString(value){if(typeof value=="string"){return value}if(isSymbol(value)){return symbolToString?symbolToString.call(value):""}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function castPath(value){return isArray(value)?value:stringToPath(value)}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function hasPath(object,path,hasFunc){path=isKey(path,object)?[path]:castPath(path);var result,index=-1,length=path.length;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key))){break}object=object[key]}if(result){return result}var length=object?object.length:0;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isArguments(object))}function isIndex(value,length){length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(typeof value=="number"||reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}function isKey(value,object){if(isArray(value)){return false}var type=typeof value;if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)){return true}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var stringToPath=memoize((function(string){string=toString(string);var result=[];if(reLeadingDot.test(string)){result.push("")}string.replace(rePropName,(function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}));return result}));function toKey(value){if(typeof value=="string"||isSymbol(value)){return value}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function memoize(func,resolver){if(typeof func!="function"||resolver&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result);return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function eq(value,other){return value===other||value!==value&&other!==other}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}var isArray=Array.isArray;function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toString(value){return value==null?"":baseToString(value)}function has(object,path){return object!=null&&hasPath(object,path,baseHas)}module.exports=has}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],10:[function(require,module,exports){(function(global){var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var INFINITY=1/0;var funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reEscapeChar=/\\(\\)?/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();function getValue(object,key){return object==null?undefined:object[key]}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=root["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var objectToString=objectProto.toString;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Symbol=root.Symbol,splice=arrayProto.splice;var Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var symbolProto=Symbol?Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function Hash(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key)["delete"](key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){getMapData(this,key).set(key,value);return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}function baseGet(object,path){path=isKey(path,object)?[path]:castPath(path);var index=0,length=path.length;while(object!=null&&index<length){object=object[toKey(path[index++])]}return index&&index==length?object:undefined}function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0){start=-start>length?0:length+start}end=end>length?length:end;if(end<0){end+=length}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length){result[index]=array[index+start]}return result}function baseToString(value){if(typeof value=="string"){return value}if(isSymbol(value)){return symbolToString?symbolToString.call(value):""}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function baseUnset(object,path){path=isKey(path,object)?[path]:castPath(path);object=parent(object,path);var key=toKey(last(path));return!(object!=null&&hasOwnProperty.call(object,key))||delete object[key]}function castPath(value){return isArray(value)?value:stringToPath(value)}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function isKey(value,object){if(isArray(value)){return false}var type=typeof value;if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)){return true}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}function parent(object,path){return path.length==1?object:baseGet(object,baseSlice(path,0,-1))}var stringToPath=memoize((function(string){string=toString(string);var result=[];if(reLeadingDot.test(string)){result.push("")}string.replace(rePropName,(function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}));return result}));function toKey(value){if(typeof value=="string"||isSymbol(value)){return value}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function memoize(func,resolver){if(typeof func!="function"||resolver&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result);return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function eq(value,other){return value===other||value!==value&&other!==other}var isArray=Array.isArray;function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toString(value){return value==null?"":baseToString(value)}function unset(object,path){return object==null?true:baseUnset(object,path)}module.exports=unset}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]); |
{ | ||
"name": "abolish-browser", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Browser version of abolish javascript validator", | ||
@@ -16,3 +16,3 @@ "main": "abolish.js", | ||
"devDependencies": { | ||
"abolish": "^0.0.13", | ||
"abolish": "^0.0.14", | ||
"browserify": "^16.5.0", | ||
@@ -19,0 +19,0 @@ "terser": "^4.6.7" |
Sorry, the diff of this file is too big to display
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