n4s 3.1.0 → 4.0.0-dev-e266d9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +1 -2
  3. package/README.md +2 -5
  4. package/compose/package.json +7 -0
  5. package/compounds/package.json +7 -0
  6. package/dist/cjs/compose.development.js +139 -0
  7. package/dist/cjs/compose.js +7 -0
  8. package/dist/cjs/compose.production.js +1 -0
  9. package/dist/cjs/compounds.development.js +132 -0
  10. package/dist/cjs/compounds.js +7 -0
  11. package/dist/cjs/compounds.production.js +1 -0
  12. package/dist/cjs/n4s.development.js +602 -0
  13. package/dist/cjs/n4s.js +7 -0
  14. package/dist/cjs/n4s.production.js +1 -0
  15. package/dist/cjs/package.json +1 -0
  16. package/dist/cjs/schema.development.js +144 -0
  17. package/dist/cjs/schema.js +7 -0
  18. package/dist/cjs/schema.production.js +1 -0
  19. package/dist/es/compose.development.js +137 -0
  20. package/dist/es/compose.production.js +1 -0
  21. package/dist/es/compounds.development.js +130 -0
  22. package/dist/es/compounds.production.js +1 -0
  23. package/dist/es/n4s.development.js +597 -0
  24. package/dist/es/n4s.production.js +1 -0
  25. package/dist/es/package.json +1 -0
  26. package/dist/es/schema.development.js +140 -0
  27. package/dist/es/schema.production.js +1 -0
  28. package/dist/umd/compose.development.js +143 -0
  29. package/dist/umd/compose.production.js +1 -0
  30. package/dist/umd/compounds.development.js +136 -0
  31. package/dist/umd/compounds.production.js +1 -0
  32. package/dist/umd/n4s.development.js +606 -0
  33. package/dist/umd/n4s.production.js +1 -0
  34. package/dist/umd/schema.development.js +148 -0
  35. package/dist/umd/schema.production.js +1 -0
  36. package/docs/README.md +2 -5
  37. package/docs/_sidebar.md +0 -1
  38. package/docs/external.md +1 -28
  39. package/package.json +129 -53
  40. package/schema/package.json +7 -0
  41. package/tsconfig.json +8 -0
  42. package/types/compose.d.ts +134 -0
  43. package/types/compounds.d.ts +146 -0
  44. package/types/n4s.d.ts +167 -0
  45. package/types/schema.d.ts +151 -0
  46. package/config/jest/jest.setup.js +0 -14
  47. package/config/rollup/enforce.js +0 -8
  48. package/config/rollup/rollup.config.js +0 -3
  49. package/docs/compound.md +0 -187
  50. package/docs/custom.md +0 -52
  51. package/docs/template.md +0 -53
  52. package/esm/n4s.es.development.js +0 -1142
  53. package/esm/n4s.es.production.js +0 -1142
  54. package/esm/n4s.es.production.min.js +0 -1
  55. package/esm/package.json +0 -1
  56. package/jest.config.js +0 -3
  57. package/n4s.cjs.development.js +0 -1144
  58. package/n4s.cjs.production.js +0 -1144
  59. package/n4s.cjs.production.min.js +0 -1
  60. package/n4s.js +0 -7
  61. package/n4s.umd.development.js +0 -1231
  62. package/n4s.umd.production.js +0 -1231
  63. package/n4s.umd.production.min.js +0 -1
@@ -1 +0,0 @@
1
- var t=Object.assign;function e(e){t(this,e)}function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function r(t){return function(){return!t.apply(this,arguments)}}function i(t){return!!t===t}e.prototype.setFailFast=function(t){return this.failFast=!!t,this},e.unwrap=function(t){return e.is(t)?t.value:t},e.wrap=function(t){return e.is(t)?t:new e({value:t})},e.is=function(t){return t instanceof e};let s=r(i);function u(t){return!(isNaN(parseFloat(t))||isNaN(Number(t))||!isFinite(t))}let a=r(u);function l(t,e){return t.length===Number(e)}let o=r(l);function f(t){if(t){if(u(t))return 0===t;if(n(t,"length"))return l(t,0);if("object"==typeof t)return l(Object.keys(t),0)}return!0}let c=r(f);function h(t){return null===t}let d=r(h);function p(t){return void 0===t}let b=r(p);function m(t){p(t)||(i(t)?this.setFailed(!t):this.extend(t))}function y(t,e){let r=m.is(t),i=m.is(e);if(r&&i){if(t.setFailed(t.failed||e.failed),f(t.children)&&f(e.children))return t;if(t.children&&e.children){for(let n in t.children)y(t.children[n],e.children[n]);for(let r in e.children)n(t.children,r)||t.setChild(r,e.children[r]);return t}if(t.children){if(!e.children)return t}else t.children=e.children}else{if(r)return t;if(i)return e}return new m(!1)}function N(t){return"function"==typeof t}function g(t,n){return!n.pass&&!n.warn&&(!!e.is(t)&&t.failFast)}function w(t,e){let n=new m(!0);for(let r of[].concat(t)){if(g(e,n))break;n.extend(F(r,e))}return n}function F(t,e){return t.run(e)}function E(t,e,n){let r=new m(!0);f(e)&&r.setFailed(!0);let i=[],s=0;for(let u of e){if(null===(e=F(u,t)))return null;let a=e.pass;if(a?s++:i.push(e),n)if("any"===n.mode){if(a){r.extend(e);break}}else{if(r.extend(e),"all"===n.mode&&!a)break;if("one"===n.mode&&(r.setFailed(1!==s),1<s))break}else if(r.extend(e),a)break}return r.pass&&0===s&&(r.setFailed(!0),i.forEach((t=>r.extend(t)))),r}function v(t,e){var n;return null!==(n=Object.getOwnPropertyDescriptor(t,"name"))&&void 0!==n&&n.configurable?Object.defineProperty(t,"name",{value:e}):t}function A(t,e){return v((function(){let e=Array.from(arguments),n=e.splice(t.length-1);return t.apply(null,e.concat([n]))}),e||t.name)}m.is=function(t){return t instanceof m},m.prototype.asArray=function(){return this.isArray=!0,this},m.prototype.setAttribute=function(t,e){return this[t]=e,this},m.prototype.setFailed=function(t){return this.setAttribute(this.warn?"hasWarnings":"hasErrors",t),this.setAttribute("failed",t)},m.prototype.setChild=function(t,e){if(null===e)return null;let n=this.hasWarnings||e.hasWarnings||e.warn||this.warn;return this.setAttribute("hasWarnings",n&&e.failed||!1),this.setAttribute("hasErrors",this.hasErrors||e.hasErrors||!n&&e.failed||!1),this.setFailed(this.failed||e.failed),this.children=this.children||{},this.children[t]=e},m.prototype.getChild=function(t){return(this.children||{})[t]},m.prototype.extend=function(e){if(null===e)return this;e=m.is(e)?e:(new m).setAttribute("warn",!!this.warn).setFailed(!e);let n=this.failed||e.failed,r=y(e,this).children;t(this,e),f(r)||(this.children=r),this.setFailed(n),this.setAttribute("hasWarnings",!(!this.hasWarnings&&!e.hasWarnings)),this.setAttribute("hasErrors",!(!this.hasErrors&&!e.hasErrors))},Object.defineProperty(m.prototype,"pass",{get(){return!this.failed}});var O=A((function(t,e){return E(t,e,{mode:"all"})})),x=A((function(t,e){return E(t,e,{mode:"any"})}));function k(t){return!!Array.isArray(t)}let W=r(k);function j(t,r,i){let s=e.unwrap(t),u=new m(!0);for(let n in r){let i=r[n],a=s[n];if(g(a,u))break;u.setChild(n,F(i,new e({value:a,obj:s,key:n}).setFailFast(t.failFast)))}if(!(i||{}).loose)for(let t in s)if(!n(r,t))return u.setFailed(!0);return u}var q={allOf:O,anyOf:x,isArrayOf:A((function(t,n){let r=e.unwrap(t),i=new m(!0).asArray();if(W(r))return i.setFailed(!0);for(let s=0;s<r.length;s++)i.setChild(s,E(new e({value:r[s],obj:r,key:s}).setFailFast(t.failFast),n,{mode:"any"}));return i})),loose:(t,e)=>j(t,e,{loose:!0}),oneOf:A((function(t,e){return E(t,e,{mode:"one"})})),optional:A((function(t,e){let{obj:r,key:i}=t;return!(n(r,i)&&!p(r[i]||null===r[i])&&!f(e))||E(r[i],e,{mode:"all"})})),shape:j};function P(t,e){return N(t)?t.apply(null,e):t}var T={warn:function(t,e=!0){return e},message:function(t,n){return P(n,[e.unwrap(t)])},when:function(t,n,r){return r(t=!P(n,[e.unwrap(t)].concat(e.is(t)?[t.key,t.obj]:[])))}};function B(t){return String(t)===t}function C(t,e){return B(t)&&B(e)&&t.endsWith(e)}let S=r(C);function R(t,e){return t===e}let U=r(R);function $(t,e){return u(t)&&u(e)&&Number(t)>Number(e)}function D(t,e){return u(t)&&u(e)&&Number(t)>=Number(e)}function I(t,e){return!!(Array.isArray(e)&&/^[s|n|b]/.test(typeof t)||B(e)&&B(t))&&-1!==e.indexOf(t)}let M=r(I);function z(t,e){return u(t)&&u(e)&&Number(t)<=Number(e)}function G(t,e,n){return D(t,e)&&z(t,n)}let H=r(G);function J(t){return"string"==typeof t&&""===t.trim()}let K=r(J);function L(t){return Number.isNaN(t)}let Q=r(L);function V(t){return!!u(t)&&0>Number(t)}let X=r(V);function Y(t){return"number"==typeof t}let Z=r(Y),_=r(B);function tt(t){return!!t}let et=r(tt);function nt(t,e){return u(t)&&u(e)&&Number(t)<Number(e)}function rt(t,e){return e instanceof RegExp?e.test(t):!!B(e)&&new RegExp(e).test(t)}let it=r(rt);function st(t,e){return u(t)&&u(e)&&Number(t)===Number(e)}let ut=r(st);function at(t,e){return B(t)&&B(e)&&t.startsWith(e)}let lt=r(at);var ot=t({doesNotEndWith:S,doesNotStartWith:lt,endsWith:C,equals:R,greaterThan:$,greaterThanOrEquals:D,gt:$,gte:D,inside:I,isArray:k,isBetween:G,isBoolean:i,isBlank:J,isEmpty:f,isEven:t=>!!u(t)&&0==t%2,isFalsy:et,isNaN:L,isNegative:V,isNotArray:W,isNotBetween:H,isNotBlank:K,isNotBoolean:s,isNotEmpty:c,isNotNaN:Q,isNotNull:d,isNotNumber:Z,isNotNumeric:a,isNotString:_,isNotUndefined:b,isNull:h,isNumber:Y,isNumeric:u,isOdd:t=>!!u(t)&&0!=t%2,isPositive:X,isString:B,isTruthy:tt,isUndefined:p,lengthEquals:l,lengthNotEquals:o,lessThan:nt,lessThanOrEquals:z,longerThan:function(t,e){return t.length>Number(e)},longerThanOrEquals:function(t,e){return t.length>=Number(e)},lt:nt,lte:z,matches:rt,notEquals:U,notInside:M,notMatches:it,numberEquals:st,numberNotEquals:ut,shorterThan:function(t,e){return t.length<Number(e)},shorterThanOrEquals:function(t,e){return t.length<=Number(e)},startsWith:at},q,T);let ft=Function("return this")();function ct(t,e){if(N(ft.Proxy))return new Proxy(t,{get:(t,r)=>n(t,r)?t[r]:n(ot,r)&&N(ot[r])?e(r):t[r]});for(let n in ot)N(t[n])||Object.defineProperties(t,{[n]:{get:()=>e(n)}});return t}function ht(t){let r=[],i=[],s=t=>A((u=>{const a=ot[t];T[a.name]===a?i.push(((t,e,n)=>{e.setAttribute(a.name,a(t,u[0],n))})):r.push(v((t=>a.apply(null,[n(q,a.name)?e.wrap(t):e.unwrap(t)].concat(u))),t));const l=ct({},s);return l.run=t=>{const e=new m(!0);let n=!1;if(i.forEach((r=>{r(t,e,(t=>n=t))})),n)return null;for(const n of r)try{if(e.extend(n(t)),!e.pass)break}catch(t){e.setFailed(!0);break}return e},l.test=t=>l.run(e.wrap(t).setFailFast(!0)).pass,l}),t);return s(t)}function dt(t,{rule:e,value:n}){return n={message:Error(`invalid ${typeof n} value`)},i(t)||t&&i(t.pass)||((t,e=Error)=>{throw new e(`[n4s]: ${t}`)})(e.name+"wrong return value"),i(t)?(n.pass=t,n):(n.pass=t.pass,t.message&&(n.message=P(t.message)),n)}function pt(t,r,i=[]){let s=n(q,t.name),u=s?e.wrap(r).setFailFast(!0):e.unwrap(r);if(i=t.apply(null,[u].concat(i)),s||(i=dt(i,{rule:t,value:r})),!i.pass)throw i.message}let bt=t=>{const e=ct({},(n=>A((r=>(pt(ot[n],t,r),e)))));return e},mt=ct(bt,ht);var yt,Nt;Nt=bt,(yt=mt).extend=e=>(t(ot,e),N(ft.Proxy)||ct(Nt,ht),yt),mt.template=A((t=>{let n=e=>{pt(w.bind(null,t),e);const n=ct({},(t=>A((r=>(pt(ot[t],e,r),n)))));return n};return n.run=e=>w(t,e),n.test=n=>w(t,e.wrap(n).setFailFast(!0)).pass,n}));export default mt;
package/esm/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"module"}
package/jest.config.js DELETED
@@ -1,3 +0,0 @@
1
- const baseConfig = require('../../config/jest/jest.config');
2
-
3
- module.exports = baseConfig();