Comparing version 0.0.4 to 0.0.5
@@ -1,1 +0,1 @@ | ||
"use strict";var args=function args(a){var len=a.length,ls=new Array(len);for(var i=0;i<len;i++){ls[i]=a[i]}return ls},keepFirst=function keepFirst(a,b){return!b||!a.result?a:b},collectAllErrors=function collectAllErrors(a,b){if(!b||b.result)return a;var verify=function verify(x){return x&&!x.result&&[x.msg]||[]};return{msg:verify(a).concat(verify(b)),result:a.result&&b.result}},T=function T(f,msg){return function(b,smsg,_){var r=f(b);return{msg:r?smsg:msg,result:r}}},object=function object(o){return function(b,smsg,merge){return merge=merge||keepFirst,Object.keys(o).reduce(function(acc,c){return merge(acc,o[c](b[c],smsg,merge))},{msg:smsg,result:true})}},ordobject=function ordobject(o){return function(b,smsg,merge){merge=merge||keepFirst;var acc={msg:smsg,result:true};for(var i=0;i<o.length;i+=2){acc=merge(acc,o[i+1](b[o[i]],smsg,merge))}return acc}},all=function all(){var _arguments=arguments;return function(b,smsg,merge){return merge=merge||keepFirst,args(_arguments).reduce(function(acc,c){return merge(acc,c(b,smsg,merge))},{msg:smsg,result:true})}},or=function or(){var _arguments2=arguments;return function(b,smsg,merge){return merge=merge||keepFirst,args(_arguments2).reduce(function(acc,c){if(acc&&acc.result)return acc;var x=c(b,smsg,merge);if(!acc&&!x.result||x.result)return x;return merge(acc,x)},null)}},ifFail=function ifFail(f,msg){return function(b,smsg,merge){var r=f(b,smsg,merge);return r.result?r:{msg:msg,result:false}}},V=function V(f,s,m){return function(b){return m=m||keepFirst,m(f(b,s,m),null)}},validate=function validate(f,b,s){return V(f,s,keepFirst)(b)},validateAll=function validateAll(f,b,s){return V(f,s,collectAllErrors)(b)};module.exports={T:T,keepFirst:keepFirst,collectAllErrors:collectAllErrors,object:object,ordobject:ordobject,all:all,or:or,ifFail:ifFail,validate:validate,validateAll:validateAll,V:V}; | ||
"use strict";var args=function r(t){var e=t.length,n=new Array(e);for(var u=0;u<e;u++){n[u]=t[u]}return n},keepFirst=function r(t,e){return!e||!t.result?t:e},collectAllErrors=function r(t,e){if(!e||e.result)return t;var n=function r(t){return t&&!t.result&&[t.msg]||[]};return{msg:n(t).concat(n(e)),result:t.result&&e.result}},T=function r(u,l){return function(r,t,e){var n=u(r);return{msg:n?t:l,result:n}}},object=function r(l){return function(e,n,u){return u=u||keepFirst,Object.keys(l).reduce(function(r,t){return u(r,l[t](e[t],n,u))},{msg:n,result:true})}},ordobject=function r(l){return function(r,t,e){e=e||keepFirst;var n={msg:t,result:true};for(var u=0;u<l.length;u+=2){n=e(n,l[u+1](r[l[u]],t,e))}return n}},all=function r(){var t=arguments;return function(e,n,u){return u=u||keepFirst,args(t).reduce(function(r,t){return u(r,t(e,n,u))},{msg:n,result:true})}},or=function r(){var t=arguments;return function(n,u,l){return l=l||keepFirst,args(t).reduce(function(r,t){if(r&&r.result)return r;var e=t(n,u,l);if(!r&&!e.result||e.result)return e;return l(r,e)},null)}},ifFail=function r(u,l){return function(r,t,e){var n=u(r,t,e);return n.result?n:{msg:l,result:false}}},V=function r(t,e,n){return function(r){return n=n||keepFirst,n(t(r,e,n),null)}},validate=function r(t,e,n){return V(t,n,keepFirst)(e)},validateAll=function r(t,e,n){return V(t,n,collectAllErrors)(e)};module.exports={T:T,keepFirst:keepFirst,collectAllErrors:collectAllErrors,object:object,ordobject:ordobject,all:all,or:or,ifFail:ifFail,validate:validate,validateAll:validateAll,V:V}; |
{ | ||
"name": "check-fns", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "composable validation functions.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
4057
6