New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

abolish

Package Overview
Dependencies
Maintainers
1
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abolish - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

validators/array/notInArray.d.ts

2

package.json
{
"name": "abolish",
"version": "5.1.0",
"version": "5.1.1",
"description": "A javascript object validator.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,3 +8,4 @@ declare const _default: {

inArray: import("../../src/Types").AbolishValidator;
notInArray: import("../../src/Types").AbolishValidator;
};
export = _default;

@@ -11,2 +11,11 @@ "use strict";

const arrayValuesAsync_1 = __importDefault(require("./arrayValuesAsync"));
module.exports = { any: any_1.default, array: array_1.default, arraySize: arraySize_1.default, arrayValues: arrayValues_1.default, arrayValuesAsync: arrayValuesAsync_1.default, inArray: inArray_1.default };
const notInArray_1 = __importDefault(require("./notInArray"));
module.exports = {
any: any_1.default,
array: array_1.default,
arraySize: arraySize_1.default,
arrayValues: arrayValues_1.default,
arrayValuesAsync: arrayValuesAsync_1.default,
inArray: inArray_1.default,
notInArray: notInArray_1.default
};

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

"use strict";var AbolishArrayValidators=(()=>{var F=Object.create;var h=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,j=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var R=(e,r,t)=>r in e?h(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,c=(e,r)=>{for(var t in r||(r={}))x.call(r,t)&&R(e,t,r[t]);if(V)for(var t of V(r))B.call(r,t)&&R(e,t,r[t]);return e};var T=(e,r)=>()=>(e&&(r=e(e=0)),r);var f=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var H=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of M(r))!x.call(e,a)&&a!==t&&h(e,a,{get:()=>r[a],enumerable:!(n=L(r,a))||n.enumerable});return e};var J=(e,r,t)=>(t=e!=null?F(j(e)):{},H(r||!e||!e.__esModule?h(t,"default",{value:e,enumerable:!0}):t,e));var _=(e,r,t)=>new Promise((n,a)=>{var i=y=>{try{o(t.next(y))}catch(u){a(u)}},s=y=>{try{o(t.throw(y))}catch(u){a(u)}},o=y=>y.done?n(y.value):Promise.resolve(y.value).then(i,s);o((t=t.apply(e,r)).next())});var k=f((fr,v)=>{"use strict";v.exports={name:"any",validator:()=>{throw new Error("Abolish: [any] is deprecated, use [inArray] instead.")}}});function l(e,r,t="Options"){if(typeof r=="string"){if(typeof e===r)return!0;if(r==="array"&&Array.isArray(e))return!0}else{let n=r.includes("array");if(!n&&r.includes(typeof e))return!0;if(n&&(r.includes(typeof e)||Array.isArray(e)))return!0}throw new TypeError(`${t} must be typeof [${r}], but [${typeof e}] was given.`)}function w(e,r){return typeof r=="string"&&(r=[r]),e.length?!e.some(t=>{try{return l(t,r),!1}catch(n){return!0}}):!0}var p=T(()=>{"use strict"});var $=f((gr,S)=>{"use strict";p();S.exports={name:"inArray",validator:(e,r,{error:t})=>{l(r,["array","function"]);let n=t(":param does not exists in the given array");if(typeof r=="function"){let a=r(e);if(typeof a=="boolean")return a?!0:n;Array.isArray(a)&&(r=a)}for(let a=0;a<r.length;a++)if(r[a]===e)return!0;return n}}});var E=f((Ar,C)=>{"use strict";p();C.exports={name:"array",error:":param is not a valid array!",validator(e,r,{error:t}){return r===!1?!0:Array.isArray(e)?typeof r=="string"||Array.isArray(r)?w(e,r)?!0:t(`:param array values must be of type: [${r}]`):!0:!1}}});var q=f((dr,O)=>{"use strict";p();O.exports={name:"arraySize",validator(e,r,{error:t}){l(r,["number","array"]);let n=e.length;return typeof r=="number"&&n===r||Array.isArray(r)&&r.includes(n)?!0:t(`:param array length must be [${r}], but [${n}] was given.`)}}});var Z=f((br,D)=>{"use strict";var W=new RegExp(/([!a-zA-Z_*0-9]+)/g),X=new RegExp(/([a-zA-Z_*0-9]+:[a-zA-Z_0-9]+)/g),Y=new RegExp(/([a-zA-Z_*0-9]+:"[^"]+")/g),rr=new RegExp(/([a-zA-Z_*0-9]+:'[^']+')/g),er=new RegExp(/([a-zA-Z_*0-9]+:`[^`]+`)/g),tr=e=>{let r=e.split("|"),t={};for(let n=0;n<r.length;n++){let a=r[n];if(a.match(rr)||a.match(Y)||a.match(er)){let[i,...s]=a.split(":"),o=s.join(":");o=o.substring(1),o=o.substring(0,s.length-1),t[i]=o}else if(a.match(X)){let[i,s]=a.split(":");isNaN(s)||(s=Number(s)),t[i]=s}else if(a.match(W)){let i=a,s=!0;i.substring(0,1)==="!"&&(i=i.substring(1),s=!1),t[i]=s}}return t};D.exports=tr});function m(e){Array.isArray(e)||(e=[e]);let r={};for(let t of e)typeof t=="string"&&(t=(0,z.default)(t)),r=c(c({},r),t);return r}var z,d=T(()=>{"use strict";z=J(Z())});var I=f((Tr,N)=>{"use strict";d();p();N.exports={name:"arrayValues",error:":param array values does not match the expected types",validator:(e,r,{error:t,abolish:n,modifier:a})=>{l(e,"array","[arrayValues] value"),l(r,["string","array","object"],"[arrayValues] rule"),(typeof r=="string"||Array.isArray(r))&&(r=m(r));let i=[];for(let s=0;s<e.length;s++){let[o,y]=n.check(e[s],c({$name:`arrayValues[${s}]`},r));if(o)return t(o.message,o);i.push(y)}a.setThis(i)}}});var P=f((K,G)=>{"use strict";d();p();G.exports={name:"arrayValuesAsync",isAsync:!0,error:":param array values does not match the expected types",validator:(i,s,o)=>_(K,[i,s,o],function*(e,r,{error:t,abolish:n,modifier:a}){l(e,"array","arrayValuesAsync values"),l(r,["string","array","object"]),(typeof r=="string"||Array.isArray(r))&&(r=m(r));let y=[];for(let u=0;u<e.length;u++){let[A,U]=yield n.checkAsync(e[u],c({$name:`arrayValues[${u}]`},r));if(A)return t(A.message,A);y.push(U)}a.setThis(y)})}});var lr=f((b,Q)=>{var g=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ar=g(k()),nr=g($()),sr=g(E()),ir=g(q()),or=g(I()),yr=g(P());Q.exports={any:ar.default,array:sr.default,arraySize:ir.default,arrayValues:or.default,arrayValuesAsync:yr.default,inArray:nr.default}});return lr();})();
"use strict";var AbolishArrayValidators=(()=>{var M=Object.create;var h=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,H=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var T=(e,r,t)=>r in e?h(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,c=(e,r)=>{for(var t in r||(r={}))x.call(r,t)&&T(e,t,r[t]);if(V)for(var t of V(r))J.call(r,t)&&T(e,t,r[t]);return e};var R=(e,r)=>()=>(e&&(r=e(e=0)),r);var u=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var W=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of B(r))!x.call(e,n)&&n!==t&&h(e,n,{get:()=>r[n],enumerable:!(a=j(r,n))||a.enumerable});return e};var X=(e,r,t)=>(t=e!=null?M(H(e)):{},W(r||!e||!e.__esModule?h(t,"default",{value:e,enumerable:!0}):t,e));var _=(e,r,t)=>new Promise((a,n)=>{var i=l=>{try{o(t.next(l))}catch(f){n(f)}},s=l=>{try{o(t.throw(l))}catch(f){n(f)}},o=l=>l.done?a(l.value):Promise.resolve(l.value).then(i,s);o((t=t.apply(e,r)).next())});var w=u((gr,v)=>{"use strict";v.exports={name:"any",validator:()=>{throw new Error("Abolish: [any] is deprecated, use [inArray] instead.")}}});function y(e,r,t="Options"){if(typeof r=="string"){if(typeof e===r)return!0;if(r==="array"&&Array.isArray(e))return!0}else{let a=r.includes("array");if(!a&&r.includes(typeof e))return!0;if(a&&(r.includes(typeof e)||Array.isArray(e)))return!0}throw new TypeError(`${t} must be typeof [${r}], but [${typeof e}] was given.`)}function k(e,r){return typeof r=="string"&&(r=[r]),e.length?!e.some(t=>{try{return y(t,r),!1}catch(a){return!0}}):!0}var p=R(()=>{"use strict"});var $=u((hr,S)=>{"use strict";p();S.exports={name:"inArray",validator:(e,r,{error:t})=>{y(r,["array","function"]);let a=t(":param does not exists in the given array");if(typeof r=="function"){let n=r(e);if(typeof n=="boolean")return n?!0:a;Array.isArray(n)&&(r=n)}for(let n=0;n<r.length;n++)if(r[n]===e)return!0;return a}}});var E=u((br,C)=>{"use strict";p();C.exports={name:"array",error:":param is not a valid array!",validator(e,r,{error:t}){return r===!1?!0:Array.isArray(e)?typeof r=="string"||Array.isArray(r)?k(e,r)?!0:t(`:param array values must be of type: [${r}]`):!0:!1}}});var I=u((Tr,q)=>{"use strict";p();q.exports={name:"arraySize",validator(e,r,{error:t}){y(r,["number","array"]);let a=e.length;return typeof r=="number"&&a===r||Array.isArray(r)&&r.includes(a)?!0:t(`:param array length must be [${r}], but [${a}] was given.`)}}});var D=u((xr,O)=>{"use strict";var Y=new RegExp(/([!a-zA-Z_*0-9]+)/g),rr=new RegExp(/([a-zA-Z_*0-9]+:[a-zA-Z_0-9]+)/g),er=new RegExp(/([a-zA-Z_*0-9]+:"[^"]+")/g),tr=new RegExp(/([a-zA-Z_*0-9]+:'[^']+')/g),ar=new RegExp(/([a-zA-Z_*0-9]+:`[^`]+`)/g),nr=e=>{let r=e.split("|"),t={};for(let a=0;a<r.length;a++){let n=r[a];if(n.match(tr)||n.match(er)||n.match(ar)){let[i,...s]=n.split(":"),o=s.join(":");o=o.substring(1),o=o.substring(0,s.length-1),t[i]=o}else if(n.match(rr)){let[i,s]=n.split(":");isNaN(s)||(s=Number(s)),t[i]=s}else if(n.match(Y)){let i=n,s=!0;i.substring(0,1)==="!"&&(i=i.substring(1),s=!1),t[i]=s}}return t};O.exports=nr});function m(e){Array.isArray(e)||(e=[e]);let r={};for(let t of e)typeof t=="string"&&(t=(0,Z.default)(t)),r=c(c({},r),t);return r}var Z,d=R(()=>{"use strict";Z=X(D())});var N=u((wr,z)=>{"use strict";d();p();z.exports={name:"arrayValues",error:":param array values does not match the expected types",validator:(e,r,{error:t,abolish:a,modifier:n})=>{y(e,"array","[arrayValues] value"),y(r,["string","array","object"],"[arrayValues] rule"),(typeof r=="string"||Array.isArray(r))&&(r=m(r));let i=[];for(let s=0;s<e.length;s++){let[o,l]=a.check(e[s],c({$name:`arrayValues[${s}]`},r));if(o)return t(o.message,o);i.push(l)}n.setThis(i)}}});var P=u((K,G)=>{"use strict";d();p();G.exports={name:"arrayValuesAsync",isAsync:!0,error:":param array values does not match the expected types",validator:(i,s,o)=>_(K,[i,s,o],function*(e,r,{error:t,abolish:a,modifier:n}){y(e,"array","arrayValuesAsync values"),y(r,["string","array","object"]),(typeof r=="string"||Array.isArray(r))&&(r=m(r));let l=[];for(let f=0;f<e.length;f++){let[A,L]=yield a.checkAsync(e[f],c({$name:`arrayValues[${f}]`},r));if(A)return t(A.message,A);l.push(L)}n.setThis(l)})}});var U=u((Cr,Q)=>{"use strict";p();Q.exports={name:"notInArray",error:":param is not allowed",validator:(e,r,{error:t})=>{if(y(r,["array","function"]),typeof r=="function"){let a=r(e);if(typeof a=="boolean")return a;if(Array.isArray(a))r=a;else throw new Error("The result of [notInArray] function must be a boolean or an array")}for(let a=0;a<r.length;a++)if(r[a]===e)return!1;return!0}}});var cr=u((b,F)=>{var g=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},sr=g(w()),ir=g($()),or=g(E()),yr=g(I()),lr=g(N()),ur=g(P()),fr=g(U());F.exports={any:sr.default,array:or.default,arraySize:yr.default,arrayValues:lr.default,arrayValuesAsync:ur.default,inArray:ir.default,notInArray:fr.default}});return cr();})();
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