n4s 5.0.23 → 5.0.25-dev-20240617-b233
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.
- package/dist/cjs/compose.development.js +0 -3
- package/dist/cjs/compose.development.js.map +1 -1
- package/dist/cjs/compose.production.js +1 -1
- package/dist/cjs/compose.production.js.map +1 -1
- package/dist/cjs/compounds.development.js +0 -3
- package/dist/cjs/compounds.development.js.map +1 -1
- package/dist/cjs/compounds.production.js +1 -1
- package/dist/cjs/compounds.production.js.map +1 -1
- package/dist/cjs/date.development.js +1 -1
- package/dist/cjs/date.production.js +1 -1
- package/dist/cjs/date.production.js.map +1 -1
- package/dist/cjs/schema.development.js +0 -3
- package/dist/cjs/schema.development.js.map +1 -1
- package/dist/cjs/schema.production.js +1 -1
- package/dist/cjs/schema.production.js.map +1 -1
- package/dist/es/compose.development.js +0 -3
- package/dist/es/compose.development.js.map +1 -1
- package/dist/es/compose.production.js +1 -1
- package/dist/es/compose.production.js.map +1 -1
- package/dist/es/compounds.development.js +0 -3
- package/dist/es/compounds.development.js.map +1 -1
- package/dist/es/compounds.production.js +1 -1
- package/dist/es/compounds.production.js.map +1 -1
- package/dist/es/date.development.js +1 -1
- package/dist/es/date.production.js +1 -1
- package/dist/es/date.production.js.map +1 -1
- package/dist/es/schema.development.js +0 -3
- package/dist/es/schema.development.js.map +1 -1
- package/dist/es/schema.production.js +1 -1
- package/dist/es/schema.production.js.map +1 -1
- package/dist/umd/compose.development.js +0 -3
- package/dist/umd/compose.development.js.map +1 -1
- package/dist/umd/compose.production.js +1 -1
- package/dist/umd/compose.production.js.map +1 -1
- package/dist/umd/compounds.development.js +0 -3
- package/dist/umd/compounds.development.js.map +1 -1
- package/dist/umd/compounds.production.js +1 -1
- package/dist/umd/compounds.production.js.map +1 -1
- package/dist/umd/date.development.js +1 -1
- package/dist/umd/date.production.js +1 -1
- package/dist/umd/date.production.js.map +1 -1
- package/dist/umd/schema.development.js +0 -3
- package/dist/umd/schema.development.js.map +1 -1
- package/dist/umd/schema.production.js +1 -1
- package/dist/umd/schema.production.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","assign","invariant","StringObject","ctx","mapFirst"],"mappings":";;;;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"compose.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","assign","invariant","StringObject","ctx","mapFirst"],"mappings":";;;;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;AAM5C,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;SAEe,OAAO,GAAA;AACrB,IAAA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;SAEe,OAAO,GAAA;AACrB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAQK,SAAU,gBAAgB,CAC9B,QAAgD,EAAA;AAEhD,IAAA,OAAOA,mBAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACxC;;AC9Bc,SAAU,WAAW,CACjC,QAAyB,EACzB,YAAiB,EAAA;IAEjB,IAAI;AACF,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACnC,KAAA;IAAC,OAAM,EAAA,EAAA;AACN,QAAA,OAAOC,OAAkB,EAAE,CAAC;AAC7B,KAAA;AACH;;ACNA;AAEc,SAAU,OAAO,CAC7B,GAAG,UAA6B,EAAA;AAEhC,IAAA,OAAOC,gBAAM,CACX,CAAC,KAAU,KAAI;AACb,QAAA,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAEvB,QAAAC,mBAAS,CAAC,GAAG,CAAC,IAAI,EAAEC,sBAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,KAAC,EACD;QACE,GAAG;QACH,IAAI,EAAE,CAAC,KAAU,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI;AACtC,KAAA,CACF,CAAC;IAEF,SAAS,GAAG,CAAC,KAAU,EAAA;QACrB,OAAOC,OAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,MAAK;YAC7B,OAAO,gBAAgB,CACrBC,kBAAQ,CACN,UAAU,EACV,CACE,SAA0B,EAC1B,QAAiE,KAC/D;AACF;;;;AAIE;gBAEF,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gBAE1C,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC1B,CACF,CACF,CAAC;AACJ,SAAC,CAAC,CAAC;KACJ;AACH;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("n4s"),n=require("vest-utils");function r(t,n){
|
|
1
|
+
"use strict";var t=require("n4s"),n=require("vest-utils");function r(t,n){return{pass:t}}function s(t){return n.defaultTo(t,r(!0))}function u(t,n){try{return t.run(n)}catch(t){return r(!1)}}module.exports=function(...r){return n.assign((t=>{const r=e(t);n.invariant(r.pass,n.StringObject(r.message))}),{run:e,test:t=>e(t).pass});function e(e){return t.ctx.run({value:e},(()=>s(n.mapFirst(r,((t,n)=>{const r=u(t,e);n(!r.pass,r)})))))}};
|
|
2
2
|
//# sourceMappingURL=compose.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"compose.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn","pass","message","defaultToPassing","callback","defaultTo","runLazyRule","lazyRule","currentValue","run","_a","composites","assign","value","res","invariant","StringObject","test","ctx","mapFirst","composite","breakout"],"mappings":"0DAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,CAgBM,SAAUE,EACdC,GAEA,OAAOC,YAAUD,EAZVJ,GAAW,GAapB,CC9Bc,SAAUM,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,ODMKV,GAAW,ECLjB,CACH,gBCJc,YACTW,GAEH,OAAOC,EAAAA,QACJC,IACC,MAAMC,EAAML,EAAII,GAEhBE,EAASA,UAACD,EAAIb,KAAMe,EAAYA,aAACF,EAAIZ,SAAS,GAEhD,CACEO,MACAQ,KAAOJ,GAAeJ,EAAII,GAAOZ,OAIrC,SAASQ,EAAII,GACX,OAAOK,MAAIT,IAAI,CAAEI,UAAS,IACjBV,EACLgB,EAAQA,SACNR,GACA,CACES,EACAC,KAQA,MAAMP,EAAMR,EAAYc,EAAWP,GAEnCQ,GAAUP,EAAIb,KAAMa,EAAI,MAKjC,CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compounds.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/rules/equals.ts","../../src/plugins/compounds/oneOf.ts","../../src/exports/compounds.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ruleReturn.defaultToFailing","bindNot","greaterThan","enforce"],"mappings":";;;;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"compounds.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/rules/equals.ts","../../src/plugins/compounds/oneOf.ts","../../src/exports/compounds.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ruleReturn.defaultToFailing","bindNot","greaterThan","enforce"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=require("n4s"),
|
|
1
|
+
"use strict";var n=require("n4s"),r=require("vest-utils");function t(n,r){return{pass:n}}function e(){return t(!1)}function u(n){return r.defaultTo(n,t(!0))}function s(n,r){try{return n.run(r)}catch(n){return e()}}function i(n,r){return n===r}r.bindNot(i);n.enforce.extend({allOf:function(n,...t){return u(r.mapFirst(t,((r,t)=>{const e=s(r,n);t(!e.pass,e)})))},anyOf:function(n,...t){return u=r.mapFirst(t,((r,t)=>{const e=s(r,n);t(e.pass,e)})),r.defaultTo(u,e());var u},noneOf:function(n,...t){return u(r.mapFirst(t,((r,t)=>{t(s(r,n).pass,e())})))},oneOf:function(n,...e){let u=0;return e.some((t=>{if(s(t,n).pass&&u++,r.greaterThan(u,1))return!1})),t(i(u,1))}});
|
|
2
2
|
//# sourceMappingURL=compounds.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compounds.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/rules/equals.ts","../../src/exports/compounds.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/plugins/compounds/oneOf.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"compounds.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/rules/equals.ts","../../src/exports/compounds.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/plugins/compounds/oneOf.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n"],"names":["ruleReturn","pass","message","failing","defaultToPassing","callback","defaultTo","runLazyRule","lazyRule","currentValue","run","_a","ruleReturn.failing","equals","value","arg1","bindNot","enforce","extend","allOf","rules","ruleReturn.defaultToPassing","mapFirst","rule","breakout","res","anyOf","noneOf","oneOf","passingCount","some","greaterThan"],"mappings":"0DAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,UAEgBE,IACd,OAAOH,GAAW,EACpB,CAYM,SAAUI,EACdC,GAEA,OAAOC,YAAUD,EAZVL,GAAW,GAapB,CC9Bc,SAAUO,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,OAAOC,GACR,CACH,CCXgB,SAAAC,EAAOC,EAAgBC,GACrC,OAAOD,IAAUC,CACnB,CAEyBC,EAAAA,QAAQH,GCIjCI,EAAAA,QAAQC,OAAO,CAAEC,eCHKL,KAAmBM,GACvC,OAAOC,EACLC,EAAQA,SAACF,GAAO,CAACG,EAAMC,KACrB,MAAMC,EAAMlB,EAAYgB,EAAMT,GAC9BU,GAAUC,EAAIxB,KAAMwB,EAAI,IAG9B,EDJwBC,eEHFZ,KAAmBM,GACvC,OLiBAf,EKhBEiB,EAAQA,SAACF,GAAO,CAACG,EAAMC,KACrB,MAAMC,EAAMlB,EAAYgB,EAAMT,GAC9BU,EAASC,EAAIxB,KAAMwB,EAAI,ILgBpBnB,YAAUD,EAAUF,KAHvB,IACJE,CKXF,EFJ+BsB,gBGHRb,KAAmBM,GACxC,OAAOC,EACLC,EAAQA,SAACF,GAAO,CAACG,EAAMC,KAGrBA,EAFYjB,EAAYgB,EAAMT,GAEjBb,KAAMW,IAAqB,IAG9C,EHLuCgB,eIDjBd,KAAmBM,GACvC,IAAIS,EAAe,EAanB,OAZAT,EAAMU,MAAKP,IAOT,GANYhB,EAAYgB,EAAMT,GAEtBb,MACN4B,IAGEE,EAAWA,YAACF,EAXG,GAYjB,OAAO,CACR,IAGI7B,EAAWa,EAAOgB,EAhBJ,GAiBvB"}
|
|
@@ -59,7 +59,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
59
59
|
|
|
60
60
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
61
61
|
|
|
62
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike
|
|
62
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
63
63
|
|
|
64
64
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
65
65
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("n4s");function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){if(!("string"==typeof t||t instanceof String)){var n=r(t);throw null===t?n="null":"object"===n&&(n=t.constructor.name),new TypeError("Expected a string but received a ".concat(n))}}function e(t){return n(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;for(var n in r)void 0===t[n]&&(t[n]=r[n]);return t}function i(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],e=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(n.push(a.value),!r||n.length!==r);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==u.return||u.return()}finally{if(o)throw i}}return n}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,r){if(t){if("string"==typeof t)return u(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,r):void 0}}function u(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}var c={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1};var f=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,d=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,l=function(t){var r=t.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);if(r){var n=Number(r[1]),e=Number(r[2]);return n%4==0&&n%100!=0||n%400==0?e<=366:e<=365}var o=t.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number),i=o[1],a=o[2],u=o[3],c=a?"0".concat(a).slice(-2):a,f=u?"0".concat(u).slice(-2):u,d=new Date("".concat(i,"-").concat(c||"01","-").concat(f||"01"));return!a||!u||d.getUTCFullYear()===i&&d.getUTCMonth()+1===a&&d.getUTCDate()===u};t.enforce.extend({isAfter:function(t,r){var n=e((null==r?void 0:r.comparisonDate)||r||Date().toString()),o=e(t);return!!(o&&n&&o>n)},isBefore:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);n(t);var o=e(r),i=e(t);return!!(i&&o&&i<o)},isDate:function(t,r){if(r=o("string"==typeof r?{format:r}:r,c),"string"==typeof t&&(v=r.format,/(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(v))){var n,e=r.delimiters.find((function(t){return-1!==r.format.indexOf(t)})),u=r.strictMode?e:r.delimiters.find((function(r){return-1!==t.indexOf(r)})),f=function(t,r){for(var n=[],e=Math.min(t.length,r.length),o=0;o<e;o++)n.push([t[o],r[o]]);return n}(t.split(u),r.format.toLowerCase().split(e)),d={},l=function(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=a(t))||r
|
|
1
|
+
"use strict";var t=require("n4s");function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){if(!("string"==typeof t||t instanceof String)){var n=r(t);throw null===t?n="null":"object"===n&&(n=t.constructor.name),new TypeError("Expected a string but received a ".concat(n))}}function e(t){return n(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;for(var n in r)void 0===t[n]&&(t[n]=r[n]);return t}function i(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],e=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(n.push(a.value),!r||n.length!==r);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==u.return||u.return()}finally{if(o)throw i}}return n}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,r){if(t){if("string"==typeof t)return u(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,r):void 0}}function u(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}var c={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1};var f=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,d=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,l=function(t){var r=t.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);if(r){var n=Number(r[1]),e=Number(r[2]);return n%4==0&&n%100!=0||n%400==0?e<=366:e<=365}var o=t.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number),i=o[1],a=o[2],u=o[3],c=a?"0".concat(a).slice(-2):a,f=u?"0".concat(u).slice(-2):u,d=new Date("".concat(i,"-").concat(c||"01","-").concat(f||"01"));return!a||!u||d.getUTCFullYear()===i&&d.getUTCMonth()+1===a&&d.getUTCDate()===u};t.enforce.extend({isAfter:function(t,r){var n=e((null==r?void 0:r.comparisonDate)||r||Date().toString()),o=e(t);return!!(o&&n&&o>n)},isBefore:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);n(t);var o=e(r),i=e(t);return!!(i&&o&&i<o)},isDate:function(t,r){if(r=o("string"==typeof r?{format:r}:r,c),"string"==typeof t&&(v=r.format,/(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(v))){var n,e=r.delimiters.find((function(t){return-1!==r.format.indexOf(t)})),u=r.strictMode?e:r.delimiters.find((function(r){return-1!==t.indexOf(r)})),f=function(t,r){for(var n=[],e=Math.min(t.length,r.length),o=0;o<e;o++)n.push([t[o],r[o]]);return n}(t.split(u),r.format.toLowerCase().split(e)),d={},l=function(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=a(t))||r){n&&(t=n);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,i=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw i}}}}(f);try{for(l.s();!(n=l.n()).done;){var s=i(n.value,2),y=s[0],m=s[1];if(y.length!==m.length)return!1;d[m.charAt(0)]=y}}catch(t){l.e(t)}finally{l.f()}return new Date("".concat(d.m,"/").concat(d.d,"/").concat(d.y)).getDate()===+d.d}var v;return!r.strictMode&&("[object Date]"===Object.prototype.toString.call(t)&&isFinite(t))},isISO8601:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(t);var e=r.strictSeparator?d.test(t):f.test(t);return e&&r.strict?l(t):e}});
|
|
2
2
|
//# sourceMappingURL=date.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.production.js","sources":["../../src/exports/date.ts"],"sourcesContent":["import { enforce } from 'n4s';\nimport isAfter from 'validator/es/lib/isAfter';\nimport isBefore from 'validator/es/lib/isBefore';\nimport isDate from 'validator/es/lib/isDate';\nimport isISO8601 from 'validator/es/lib/isISO8601';\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\n\nenforce.extend({ isAfter, isBefore, isDate, isISO8601 });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isAfter: EnforceCustomMatcher<typeof isAfter, R>;\n isBefore: EnforceCustomMatcher<typeof isBefore, R>;\n isDate: EnforceCustomMatcher<typeof isDate, R>;\n isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;\n }\n }\n}\n"],"names":["enforce","extend","isAfter","isBefore","isDate","isISO8601"],"mappings":"qqFAQAA,EAAAA,QAAQC,OAAO,CAAEC,mHAASC,+IAAUC,
|
|
1
|
+
{"version":3,"file":"date.production.js","sources":["../../src/exports/date.ts"],"sourcesContent":["import { enforce } from 'n4s';\nimport isAfter from 'validator/es/lib/isAfter';\nimport isBefore from 'validator/es/lib/isBefore';\nimport isDate from 'validator/es/lib/isDate';\nimport isISO8601 from 'validator/es/lib/isISO8601';\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\n\nenforce.extend({ isAfter, isBefore, isDate, isISO8601 });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isAfter: EnforceCustomMatcher<typeof isAfter, R>;\n isBefore: EnforceCustomMatcher<typeof isBefore, R>;\n isDate: EnforceCustomMatcher<typeof isDate, R>;\n isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;\n }\n }\n}\n"],"names":["enforce","extend","isAfter","isBefore","isDate","isISO8601"],"mappings":"qqFAQAA,EAAAA,QAAQC,OAAO,CAAEC,mHAASC,+IAAUC,q8CAAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ctx","ruleReturn.passing","isNullish","hasOwnProperty","enforce"],"mappings":";;;;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ctx","ruleReturn.passing","isNullish","hasOwnProperty","enforce"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=require("n4s"),
|
|
1
|
+
"use strict";var n=require("n4s"),r=require("vest-utils");function t(n,r){return{pass:n}}function e(){return t(!1)}function u(){return t(!0)}function o(n,r){try{return n.run(r)}catch(n){return e()}}function s(r,t){for(const e in t){const u=r[e],s=t[e],i=n.ctx.run({value:u,set:!0,meta:{key:e}},(()=>o(s,u)));if(!i.pass)return i}return u()}n.enforce.extend({isArrayOf:function(t,e){return s=r.mapFirst(t,((r,t,u)=>{const s=n.ctx.run({value:r,set:!0,meta:{index:u}},(()=>o(e,r)));t(!s.pass,s)})),r.defaultTo(s,u());var s},loose:s,optional:function(n,t){return r.isNullish(n)?u():o(t,n)},shape:function(n,t){const o=s(n,t);if(!o.pass)return o;for(const u in n)if(!r.hasOwnProperty(t,u))return e();return u()}}),exports.partial=function(r){const t={};for(const e in r)t[e]=n.enforce.optional(r[e]);return t};
|
|
2
2
|
//# sourceMappingURL=schema.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/loose.ts","../../src/exports/schema.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"schema.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/loose.ts","../../src/exports/schema.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n"],"names":["ruleReturn","pass","message","failing","passing","runLazyRule","lazyRule","currentValue","run","_a","ruleReturn.failing","loose","inputObject","shapeObject","key","currentRule","res","ctx","value","set","meta","ruleReturn.passing","enforce","extend","isArrayOf","inputArray","callback","mapFirst","breakout","index","defaultTo","optional","ruleChain","isNullish","shape","baseRes","hasOwnProperty","output"],"mappings":"0DAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,UAEgBE,IACd,OAAOH,GAAW,EACpB,UAEgBI,IACd,OAAOJ,GAAW,EACpB,CClBc,SAAUK,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,OAAOC,GACR,CACH,CCNgB,SAAAC,EACdC,EACAC,GAEA,IAAK,MAAMC,KAAOD,EAAa,CAC7B,MAAMN,EAAeK,EAAYE,GAC3BC,EAAcF,EAAYC,GAE1BE,EAAMC,EAAAA,IAAIT,IAAI,CAAEU,MAAOX,EAAcY,KAAK,EAAMC,KAAM,CAAEN,SAAS,IACrET,EAAYU,EAAaR,KAG3B,IAAKS,EAAIf,KACP,OAAOe,CAEV,CAED,OAAOK,GACT,CCdAC,EAAAA,QAAQC,OAAO,CAAEC,UCHD,SACdC,EACAV,GAEA,OJmBAW,EIlBEC,EAAAA,SAASF,GAAY,CAAClB,EAAcqB,EAAUC,KAC5C,MAAMb,EAAMC,EAAAA,IAAIT,IACd,CAAEU,MAAOX,EAAcY,KAAK,EAAMC,KAAM,CAAES,WAC1C,IAAMxB,EAAYU,EAAaR,KAGjCqB,GAAUZ,EAAIf,KAAMe,EAAI,IJcrBc,YAAUJ,EAAUtB,KAHvB,IACJsB,CITF,EDX4Bf,QAAOoB,SEJnB,SAASb,EAAYc,GACnC,OAAIC,EAAAA,UAAUf,GACLG,IAEFhB,EAAY2B,EAAWd,EAChC,EFD6CgB,MGJ7B,SACdtB,EACAC,GAEA,MAAMsB,EAAUxB,EAAMC,EAAaC,GACnC,IAAKsB,EAAQlC,KACX,OAAOkC,EAET,IAAK,MAAMrB,KAAOF,EAChB,IAAKwB,EAAcA,eAACvB,EAAaC,GAC/B,OAAOJ,IAIX,OAAOW,GACT,oBClBM,SAA8CR,GAClD,MAAMwB,EAAS,CAAA,EACf,IAAK,MAAMvB,KAAOD,EAChBwB,EAAOvB,GAAOQ,EAAOA,QAACS,SAASlB,EAAYC,IAK7C,OAAOuB,CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn.failing"],"mappings":";;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"compose.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn.failing"],"mappings":";;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;AAM5C,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;SAEe,OAAO,GAAA;AACrB,IAAA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;SAEe,OAAO,GAAA;AACrB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAQK,SAAU,gBAAgB,CAC9B,QAAgD,EAAA;AAEhD,IAAA,OAAO,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACxC;;AC9Bc,SAAU,WAAW,CACjC,QAAyB,EACzB,YAAiB,EAAA;IAEjB,IAAI;AACF,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACnC,KAAA;IAAC,OAAM,EAAA,EAAA;AACN,QAAA,OAAOA,OAAkB,EAAE,CAAC;AAC7B,KAAA;AACH;;ACNA;AAEc,SAAU,OAAO,CAC7B,GAAG,UAA6B,EAAA;AAEhC,IAAA,OAAO,MAAM,CACX,CAAC,KAAU,KAAI;AACb,QAAA,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAEvB,QAAA,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,KAAC,EACD;QACE,GAAG;QACH,IAAI,EAAE,CAAC,KAAU,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI;AACtC,KAAA,CACF,CAAC;IAEF,SAAS,GAAG,CAAC,KAAU,EAAA;QACrB,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,MAAK;YAC7B,OAAO,gBAAgB,CACrB,QAAQ,CACN,UAAU,EACV,CACE,SAA0B,EAC1B,QAAiE,KAC/D;AACF;;;;AAIE;gBAEF,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gBAE1C,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAC1B,CACF,CACF,CAAC;AACJ,SAAC,CAAC,CAAC;KACJ;AACH;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ctx as t}from"n4s";import{defaultTo as n,assign as r,invariant as s,StringObject as u,mapFirst as e}from"vest-utils";function o(t,n){
|
|
1
|
+
import{ctx as t}from"n4s";import{defaultTo as n,assign as r,invariant as s,StringObject as u,mapFirst as e}from"vest-utils";function o(t,n){return{pass:t}}function a(t){return n(t,o(!0))}function c(t,n){try{return t.run(n)}catch(t){return o(!1)}}function f(...n){return r((t=>{const n=o(t);s(n.pass,u(n.message))}),{run:o,test:t=>o(t).pass});function o(r){return t.run({value:r},(()=>a(e(n,((t,n)=>{const s=c(t,r);n(!s.pass,s)})))))}}export{f as default};
|
|
2
2
|
//# sourceMappingURL=compose.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"compose.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn","pass","message","defaultToPassing","callback","defaultTo","runLazyRule","lazyRule","currentValue","run","_a","compose","composites","assign","value","res","invariant","StringObject","test","ctx","mapFirst","composite","breakout"],"mappings":"4HAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,CAgBM,SAAUE,EACdC,GAEA,OAAOC,EAAUD,EAZVJ,GAAW,GAapB,CC9Bc,SAAUM,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,ODMKV,GAAW,ECLjB,CACH,CCJc,SAAUW,KACnBC,GAEH,OAAOC,GACJC,IACC,MAAMC,EAAMN,EAAIK,GAEhBE,EAAUD,EAAId,KAAMgB,EAAaF,EAAIb,SAAS,GAEhD,CACEO,MACAS,KAAOJ,GAAeL,EAAIK,GAAOb,OAIrC,SAASQ,EAAIK,GACX,OAAOK,EAAIV,IAAI,CAAEK,UAAS,IACjBX,EACLiB,EACER,GACA,CACES,EACAC,KAQA,MAAMP,EAAMT,EAAYe,EAAWP,GAEnCQ,GAAUP,EAAId,KAAMc,EAAI,MAKjC,CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compounds.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/rules/equals.ts","../../src/plugins/compounds/oneOf.ts","../../src/exports/compounds.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n"],"names":["ruleReturn.failing","ruleReturn.defaultToPassing","ruleReturn.defaultToFailing"],"mappings":";;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"compounds.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/rules/equals.ts","../../src/plugins/compounds/oneOf.ts","../../src/exports/compounds.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n"],"names":["ruleReturn.failing","ruleReturn.defaultToPassing","ruleReturn.defaultToFailing"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{enforce as n}from"n4s";import{defaultTo as t,mapFirst as r,bindNot as u,greaterThan as e}from"vest-utils";function o(n,t){
|
|
1
|
+
import{enforce as n}from"n4s";import{defaultTo as t,mapFirst as r,bindNot as u,greaterThan as e}from"vest-utils";function o(n,t){return{pass:n}}function f(){return o(!1)}function s(n){return t(n,o(!0))}function c(n,t){try{return n.run(t)}catch(n){return f()}}function i(n,t){return n===t}u(i);n.extend({allOf:function(n,...t){return s(r(t,((t,r)=>{const u=c(t,n);r(!u.pass,u)})))},anyOf:function(n,...u){return e=r(u,((t,r)=>{const u=c(t,n);r(u.pass,u)})),t(e,f());var e},noneOf:function(n,...t){return s(r(t,((t,r)=>{r(c(t,n).pass,f())})))},oneOf:function(n,...t){let r=0;return t.some((t=>{if(c(t,n).pass&&r++,e(r,1))return!1})),o(i(r,1))}});
|
|
2
2
|
//# sourceMappingURL=compounds.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compounds.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/rules/equals.ts","../../src/exports/compounds.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/plugins/compounds/oneOf.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"compounds.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/rules/equals.ts","../../src/exports/compounds.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/plugins/compounds/oneOf.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n"],"names":["ruleReturn","pass","message","failing","defaultToPassing","callback","defaultTo","runLazyRule","lazyRule","currentValue","run","_a","ruleReturn.failing","equals","value","arg1","bindNot","enforce","extend","allOf","rules","ruleReturn.defaultToPassing","mapFirst","rule","breakout","res","anyOf","noneOf","oneOf","passingCount","some","greaterThan"],"mappings":"iHAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,UAEgBE,IACd,OAAOH,GAAW,EACpB,CAYM,SAAUI,EACdC,GAEA,OAAOC,EAAUD,EAZVL,GAAW,GAapB,CC9Bc,SAAUO,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,OAAOC,GACR,CACH,CCXgB,SAAAC,EAAOC,EAAgBC,GACrC,OAAOD,IAAUC,CACnB,CAEyBC,EAAQH,GCIjCI,EAAQC,OAAO,CAAEC,eCHKL,KAAmBM,GACvC,OAAOC,EACLC,EAASF,GAAO,CAACG,EAAMC,KACrB,MAAMC,EAAMlB,EAAYgB,EAAMT,GAC9BU,GAAUC,EAAIxB,KAAMwB,EAAI,IAG9B,EDJwBC,eEHFZ,KAAmBM,GACvC,OLiBAf,EKhBEiB,EAASF,GAAO,CAACG,EAAMC,KACrB,MAAMC,EAAMlB,EAAYgB,EAAMT,GAC9BU,EAASC,EAAIxB,KAAMwB,EAAI,ILgBpBnB,EAAUD,EAAUF,KAHvB,IACJE,CKXF,EFJ+BsB,gBGHRb,KAAmBM,GACxC,OAAOC,EACLC,EAASF,GAAO,CAACG,EAAMC,KAGrBA,EAFYjB,EAAYgB,EAAMT,GAEjBb,KAAMW,IAAqB,IAG9C,EHLuCgB,eIDjBd,KAAmBM,GACvC,IAAIS,EAAe,EAanB,OAZAT,EAAMU,MAAKP,IAOT,GANYhB,EAAYgB,EAAMT,GAEtBb,MACN4B,IAGEE,EAAYF,EAXG,GAYjB,OAAO,CACR,IAGI7B,EAAWa,EAAOgB,EAhBJ,GAiBvB"}
|
|
@@ -57,7 +57,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
57
57
|
|
|
58
58
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
59
59
|
|
|
60
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike
|
|
60
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
61
61
|
|
|
62
62
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
63
63
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{enforce as t}from"n4s";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){if(!("string"==typeof t||t instanceof String)){var n=r(t);throw null===t?n="null":"object"===n&&(n=t.constructor.name),new TypeError("Expected a string but received a ".concat(n))}}function e(t){return n(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;for(var n in r)void 0===t[n]&&(t[n]=r[n]);return t}function i(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],e=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(n.push(a.value),!r||n.length!==r);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==u.return||u.return()}finally{if(o)throw i}}return n}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,r){if(t){if("string"==typeof t)return u(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,r):void 0}}function u(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}var c={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1};var f=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,d=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,l=function(t){var r=t.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);if(r){var n=Number(r[1]),e=Number(r[2]);return n%4==0&&n%100!=0||n%400==0?e<=366:e<=365}var o=t.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number),i=o[1],a=o[2],u=o[3],c=a?"0".concat(a).slice(-2):a,f=u?"0".concat(u).slice(-2):u,d=new Date("".concat(i,"-").concat(c||"01","-").concat(f||"01"));return!a||!u||d.getUTCFullYear()===i&&d.getUTCMonth()+1===a&&d.getUTCDate()===u};t.extend({isAfter:function(t,r){var n=e((null==r?void 0:r.comparisonDate)||r||Date().toString()),o=e(t);return!!(o&&n&&o>n)},isBefore:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);n(t);var o=e(r),i=e(t);return!!(i&&o&&i<o)},isDate:function(t,r){if(r=o("string"==typeof r?{format:r}:r,c),"string"==typeof t&&(v=r.format,/(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(v))){var n,e=r.delimiters.find((function(t){return-1!==r.format.indexOf(t)})),u=r.strictMode?e:r.delimiters.find((function(r){return-1!==t.indexOf(r)})),f=function(t,r){for(var n=[],e=Math.min(t.length,r.length),o=0;o<e;o++)n.push([t[o],r[o]]);return n}(t.split(u),r.format.toLowerCase().split(e)),d={},l=function(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=a(t))||r
|
|
1
|
+
import{enforce as t}from"n4s";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t){if(!("string"==typeof t||t instanceof String)){var n=r(t);throw null===t?n="null":"object"===n&&(n=t.constructor.name),new TypeError("Expected a string but received a ".concat(n))}}function e(t){return n(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;for(var n in r)void 0===t[n]&&(t[n]=r[n]);return t}function i(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],e=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(n.push(a.value),!r||n.length!==r);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==u.return||u.return()}finally{if(o)throw i}}return n}(t,r)||a(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,r){if(t){if("string"==typeof t)return u(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,r):void 0}}function u(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}var c={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1};var f=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,d=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,l=function(t){var r=t.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);if(r){var n=Number(r[1]),e=Number(r[2]);return n%4==0&&n%100!=0||n%400==0?e<=366:e<=365}var o=t.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number),i=o[1],a=o[2],u=o[3],c=a?"0".concat(a).slice(-2):a,f=u?"0".concat(u).slice(-2):u,d=new Date("".concat(i,"-").concat(c||"01","-").concat(f||"01"));return!a||!u||d.getUTCFullYear()===i&&d.getUTCMonth()+1===a&&d.getUTCDate()===u};t.extend({isAfter:function(t,r){var n=e((null==r?void 0:r.comparisonDate)||r||Date().toString()),o=e(t);return!!(o&&n&&o>n)},isBefore:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);n(t);var o=e(r),i=e(t);return!!(i&&o&&i<o)},isDate:function(t,r){if(r=o("string"==typeof r?{format:r}:r,c),"string"==typeof t&&(v=r.format,/(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(v))){var n,e=r.delimiters.find((function(t){return-1!==r.format.indexOf(t)})),u=r.strictMode?e:r.delimiters.find((function(r){return-1!==t.indexOf(r)})),f=function(t,r){for(var n=[],e=Math.min(t.length,r.length),o=0;o<e;o++)n.push([t[o],r[o]]);return n}(t.split(u),r.format.toLowerCase().split(e)),d={},l=function(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=a(t))||r){n&&(t=n);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,i=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw i}}}}(f);try{for(l.s();!(n=l.n()).done;){var y=i(n.value,2),s=y[0],m=y[1];if(s.length!==m.length)return!1;d[m.charAt(0)]=s}}catch(t){l.e(t)}finally{l.f()}return new Date("".concat(d.m,"/").concat(d.d,"/").concat(d.y)).getDate()===+d.d}var v;return!r.strictMode&&("[object Date]"===Object.prototype.toString.call(t)&&isFinite(t))},isISO8601:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(t);var e=r.strictSeparator?d.test(t):f.test(t);return e&&r.strict?l(t):e}});
|
|
2
2
|
//# sourceMappingURL=date.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.production.js","sources":["../../src/exports/date.ts"],"sourcesContent":["import { enforce } from 'n4s';\nimport isAfter from 'validator/es/lib/isAfter';\nimport isBefore from 'validator/es/lib/isBefore';\nimport isDate from 'validator/es/lib/isDate';\nimport isISO8601 from 'validator/es/lib/isISO8601';\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\n\nenforce.extend({ isAfter, isBefore, isDate, isISO8601 });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isAfter: EnforceCustomMatcher<typeof isAfter, R>;\n isBefore: EnforceCustomMatcher<typeof isBefore, R>;\n isDate: EnforceCustomMatcher<typeof isDate, R>;\n isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;\n }\n }\n}\n"],"names":["enforce","extend","isAfter","isBefore","isDate","isISO8601"],"mappings":"iqFAQAA,EAAQC,OAAO,CAAEC,mHAASC,+IAAUC,
|
|
1
|
+
{"version":3,"file":"date.production.js","sources":["../../src/exports/date.ts"],"sourcesContent":["import { enforce } from 'n4s';\nimport isAfter from 'validator/es/lib/isAfter';\nimport isBefore from 'validator/es/lib/isBefore';\nimport isDate from 'validator/es/lib/isDate';\nimport isISO8601 from 'validator/es/lib/isISO8601';\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\n\nenforce.extend({ isAfter, isBefore, isDate, isISO8601 });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isAfter: EnforceCustomMatcher<typeof isAfter, R>;\n isBefore: EnforceCustomMatcher<typeof isBefore, R>;\n isDate: EnforceCustomMatcher<typeof isDate, R>;\n isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;\n }\n }\n}\n"],"names":["enforce","extend","isAfter","isBefore","isDate","isISO8601"],"mappings":"iqFAQAA,EAAQC,OAAO,CAAEC,mHAASC,+IAAUC,q8CAAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n"],"names":["ruleReturn.failing","ruleReturn.defaultToPassing","ruleReturn.passing"],"mappings":";;;AAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;AAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n"],"names":["ruleReturn.failing","ruleReturn.defaultToPassing","ruleReturn.passing"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ctx as n,enforce as t}from"n4s";import{defaultTo as r,mapFirst as o,isNullish as
|
|
1
|
+
import{ctx as n,enforce as t}from"n4s";import{defaultTo as r,mapFirst as o,isNullish as u,hasOwnProperty as e}from"vest-utils";function s(n,t){return{pass:n}}function i(){return s(!1)}function c(){return s(!0)}function f(n,t){try{return n.run(t)}catch(n){return i()}}function a(t,r){for(const o in r){const u=t[o],e=r[o],s=n.run({value:u,set:!0,meta:{key:o}},(()=>f(e,u)));if(!s.pass)return s}return c()}function p(n){const r={};for(const o in n)r[o]=t.optional(n[o]);return r}t.extend({isArrayOf:function(t,u){return e=o(t,((t,r,o)=>{const e=n.run({value:t,set:!0,meta:{index:o}},(()=>f(u,t)));r(!e.pass,e)})),r(e,c());var e},loose:a,optional:function(n,t){return u(n)?c():f(t,n)},shape:function(n,t){const r=a(n,t);if(!r.pass)return r;for(const r in n)if(!e(t,r))return i();return c()}});export{p as partial};
|
|
2
2
|
//# sourceMappingURL=schema.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"schema.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n"],"names":["ruleReturn","pass","message","failing","passing","runLazyRule","lazyRule","currentValue","run","_a","ruleReturn.failing","loose","inputObject","shapeObject","key","currentRule","res","ctx","value","set","meta","ruleReturn.passing","partial","output","enforce","optional","extend","isArrayOf","inputArray","callback","mapFirst","breakout","index","defaultTo","ruleChain","isNullish","shape","baseRes","hasOwnProperty"],"mappings":"+HAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,UAEgBE,IACd,OAAOH,GAAW,EACpB,UAEgBI,IACd,OAAOJ,GAAW,EACpB,CClBc,SAAUK,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,OAAOC,GACR,CACH,CCNgB,SAAAC,EACdC,EACAC,GAEA,IAAK,MAAMC,KAAOD,EAAa,CAC7B,MAAMN,EAAeK,EAAYE,GAC3BC,EAAcF,EAAYC,GAE1BE,EAAMC,EAAIT,IAAI,CAAEU,MAAOX,EAAcY,KAAK,EAAMC,KAAM,CAAEN,SAAS,IACrET,EAAYU,EAAaR,KAG3B,IAAKS,EAAIf,KACP,OAAOe,CAEV,CAED,OAAOK,GACT,CCrBM,SAAUC,EAAoCT,GAClD,MAAMU,EAAS,CAAA,EACf,IAAK,MAAMT,KAAOD,EAChBU,EAAOT,GAAOU,EAAQC,SAASZ,EAAYC,IAK7C,OAAOS,CACT,CCFAC,EAAQE,OAAO,CAAEC,UCHD,SACdC,EACAb,GAEA,OLmBAc,EKlBEC,EAASF,GAAY,CAACrB,EAAcwB,EAAUC,KAC5C,MAAMhB,EAAMC,EAAIT,IACd,CAAEU,MAAOX,EAAcY,KAAK,EAAMC,KAAM,CAAEY,WAC1C,IAAM3B,EAAYU,EAAaR,KAGjCwB,GAAUf,EAAIf,KAAMe,EAAI,ILcrBiB,EAAUJ,EAAUzB,KAHvB,IACJyB,CKTF,EDX4BlB,QAAOc,SEJnB,SAASP,EAAYgB,GACnC,OAAIC,EAAUjB,GACLG,IAEFhB,EAAY6B,EAAWhB,EAChC,EFD6CkB,MGJ7B,SACdxB,EACAC,GAEA,MAAMwB,EAAU1B,EAAMC,EAAaC,GACnC,IAAKwB,EAAQpC,KACX,OAAOoC,EAET,IAAK,MAAMvB,KAAOF,EAChB,IAAK0B,EAAezB,EAAaC,GAC/B,OAAOJ,IAIX,OAAOW,GACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","assign","invariant","StringObject","ctx","mapFirst"],"mappings":";;;;;;EAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;EAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"compose.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","assign","invariant","StringObject","ctx","mapFirst"],"mappings":";;;;;;EAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;EAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;EAM5C,IAAA,OAAO,MAAM,CAAC;EAChB,CAAC;WAEe,OAAO,GAAA;EACrB,IAAA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;WAEe,OAAO,GAAA;EACrB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;EAC1B,CAAC;EAQK,SAAU,gBAAgB,CAC9B,QAAgD,EAAA;EAEhD,IAAA,OAAOA,mBAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;EACxC;;EC9Bc,SAAU,WAAW,CACjC,QAAyB,EACzB,YAAiB,EAAA;MAEjB,IAAI;EACF,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;EACnC,KAAA;MAAC,OAAM,EAAA,EAAA;EACN,QAAA,OAAOC,OAAkB,EAAE,CAAC;EAC7B,KAAA;EACH;;ECNA;EAEc,SAAU,OAAO,CAC7B,GAAG,UAA6B,EAAA;EAEhC,IAAA,OAAOC,gBAAM,CACX,CAAC,KAAU,KAAI;EACb,QAAA,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;EAEvB,QAAAC,mBAAS,CAAC,GAAG,CAAC,IAAI,EAAEC,sBAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;EACjD,KAAC,EACD;UACE,GAAG;UACH,IAAI,EAAE,CAAC,KAAU,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI;EACtC,KAAA,CACF,CAAC;MAEF,SAAS,GAAG,CAAC,KAAU,EAAA;UACrB,OAAOC,OAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,MAAK;cAC7B,OAAO,gBAAgB,CACrBC,kBAAQ,CACN,UAAU,EACV,CACE,SAA0B,EAC1B,QAAiE,KAC/D;EACF;;;;EAIE;kBAEF,MAAM,GAAG,GAAG,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;kBAE1C,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;eAC1B,CACF,CACF,CAAC;EACJ,SAAC,CAAC,CAAC;OACJ;EACH;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("n4s"),require("vest-utils")):"function"==typeof define&&define.amd?define(["n4s","vest-utils"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).compose=e(t.n4s,t["vest-utils"])}(this,(function(t,e){"use strict";function n(t,e){return{pass:t}}function s(t){return e.defaultTo(t,n(!0))}function u(t,e){try{return t.run(e)}catch(t){return n(!1)}}return function(...n){return e.assign((t=>{const n=r(t);e.invariant(n.pass,e.StringObject(n.message))}),{run:r,test:t=>r(t).pass});function r(r){return t.ctx.run({value:r},(()=>s(e.mapFirst(n,((t,e)=>{const n=u(t,r);e(!n.pass,n)})))))}}}));
|
|
2
2
|
//# sourceMappingURL=compose.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"compose.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/exports/compose.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { invariant, StringObject, assign, mapFirst } from 'vest-utils';\n\nimport type { ComposeResult, LazyRuleRunners } from 'genEnforceLazy';\nimport { defaultToPassing, RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\n/* eslint-disable max-lines-per-function */\n\nexport default function compose(\n ...composites: LazyRuleRunners[]\n): ComposeResult {\n return assign(\n (value: any) => {\n const res = run(value);\n\n invariant(res.pass, StringObject(res.message));\n },\n {\n run,\n test: (value: any) => run(value).pass,\n }\n );\n\n function run(value: any): RuleDetailedResult {\n return ctx.run({ value }, () => {\n return defaultToPassing(\n mapFirst(\n composites,\n (\n composite: LazyRuleRunners,\n breakout: (conditional: boolean, res: RuleDetailedResult) => void\n ) => {\n /* HACK: Just a small white lie. ~~HELP WANTED~~.\n The ideal is that instead of `LazyRuleRunners` We would simply use `Lazy` to begin with.\n The problem is that lazy rules can't really be passed to this function due to some generic hell\n so we're limiting it to a small set of functions.\n */\n\n const res = runLazyRule(composite, value);\n\n breakout(!res.pass, res);\n }\n )\n );\n });\n }\n}\n"],"names":["ruleReturn","pass","message","defaultToPassing","callback","defaultTo","runLazyRule","lazyRule","currentValue","run","_a","composites","assign","value","res","invariant","StringObject","test","ctx","mapFirst","composite","breakout"],"mappings":"yTAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,CAgBM,SAAUE,EACdC,GAEA,OAAOC,YAAUD,EAZVJ,GAAW,GAapB,CC9Bc,SAAUM,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,ODMKV,GAAW,ECLjB,CACH,QCJc,YACTW,GAEH,OAAOC,EAAAA,QACJC,IACC,MAAMC,EAAML,EAAII,GAEhBE,EAASA,UAACD,EAAIb,KAAMe,EAAYA,aAACF,EAAIZ,SAAS,GAEhD,CACEO,MACAQ,KAAOJ,GAAeJ,EAAII,GAAOZ,OAIrC,SAASQ,EAAII,GACX,OAAOK,MAAIT,IAAI,CAAEI,UAAS,IACjBV,EACLgB,EAAQA,SACNR,GACA,CACES,EACAC,KAQA,MAAMP,EAAMR,EAAYc,EAAWP,GAEnCQ,GAAUP,EAAIb,KAAMa,EAAI,MAKjC,CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compounds.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/rules/equals.ts","../../src/plugins/compounds/oneOf.ts","../../src/exports/compounds.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ruleReturn.defaultToFailing","bindNot","greaterThan","enforce"],"mappings":";;;;;;EAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;EAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"compounds.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/rules/equals.ts","../../src/plugins/compounds/oneOf.ts","../../src/exports/compounds.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ruleReturn.defaultToFailing","bindNot","greaterThan","enforce"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("n4s"),require("vest-utils")):"function"==typeof define&&define.amd?define(["n4s","vest-utils"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).n4s,n["vest-utils"])}(this,(function(n,t){"use strict";function e(n,t){
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("n4s"),require("vest-utils")):"function"==typeof define&&define.amd?define(["n4s","vest-utils"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).n4s,n["vest-utils"])}(this,(function(n,t){"use strict";function e(n,t){return{pass:n}}function r(){return e(!1)}function u(n){return t.defaultTo(n,e(!0))}function s(n,t){try{return n.run(t)}catch(n){return r()}}function i(n,t){return n===t}t.bindNot(i);n.enforce.extend({allOf:function(n,...e){return u(t.mapFirst(e,((t,e)=>{const r=s(t,n);e(!r.pass,r)})))},anyOf:function(n,...e){return u=t.mapFirst(e,((t,e)=>{const r=s(t,n);e(r.pass,r)})),t.defaultTo(u,r());var u},noneOf:function(n,...e){return u(t.mapFirst(e,((t,e)=>{e(s(t,n).pass,r())})))},oneOf:function(n,...r){let u=0;return r.some((e=>{if(s(e,n).pass&&u++,t.greaterThan(u,1))return!1})),e(i(u,1))}})}));
|
|
2
2
|
//# sourceMappingURL=compounds.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compounds.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/rules/equals.ts","../../src/exports/compounds.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/plugins/compounds/oneOf.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"compounds.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/rules/equals.ts","../../src/exports/compounds.ts","../../src/plugins/compounds/allOf.ts","../../src/plugins/compounds/anyOf.ts","../../src/plugins/compounds/noneOf.ts","../../src/plugins/compounds/oneOf.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { bindNot } from 'vest-utils';\n\nexport function equals(value: unknown, arg1: unknown): boolean {\n return value === arg1;\n}\n\nexport const notEquals = bindNot(equals);\n","import { enforce } from 'n4s';\n\nimport { allOf } from 'allOf';\nimport { anyOf } from 'anyOf';\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { Lazy } from 'genEnforceLazy';\nimport { noneOf } from 'noneOf';\nimport { oneOf } from 'oneOf';\nimport { RuleDetailedResult } from 'ruleReturn';\n\nenforce.extend({ allOf, anyOf, noneOf, oneOf });\n\ntype EnforceCompoundRule = (\n value: unknown,\n ...rules: Lazy[]\n) => RuleDetailedResult;\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n allOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n anyOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n noneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n oneOf: EnforceCustomMatcher<EnforceCompoundRule, R>;\n }\n }\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function allOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(!res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport * as ruleReturn from 'ruleReturn';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function anyOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToFailing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n breakout(res.pass, res);\n })\n );\n}\n","import { mapFirst } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function noneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(rules, (rule, breakout) => {\n const res = runLazyRule(rule, value);\n\n breakout(res.pass, ruleReturn.failing());\n })\n );\n}\n","import { greaterThan } from 'vest-utils';\n\nimport { equals } from 'equals';\nimport type { Lazy } from 'genEnforceLazy';\nimport ruleReturn, { RuleDetailedResult } from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nconst REQUIRED_COUNT = 1;\n\nexport function oneOf(value: unknown, ...rules: Lazy[]): RuleDetailedResult {\n let passingCount = 0;\n rules.some(rule => {\n const res = runLazyRule(rule, value);\n\n if (res.pass) {\n passingCount++;\n }\n\n if (greaterThan(passingCount, REQUIRED_COUNT)) {\n return false;\n }\n });\n\n return ruleReturn(equals(passingCount, REQUIRED_COUNT));\n}\n"],"names":["ruleReturn","pass","message","failing","defaultToPassing","callback","defaultTo","runLazyRule","lazyRule","currentValue","run","_a","ruleReturn.failing","equals","value","arg1","bindNot","enforce","extend","allOf","rules","ruleReturn.defaultToPassing","mapFirst","rule","breakout","res","anyOf","noneOf","oneOf","passingCount","some","greaterThan"],"mappings":"gSAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,UAEgBE,IACd,OAAOH,GAAW,EACpB,CAYM,SAAUI,EACdC,GAEA,OAAOC,YAAUD,EAZVL,GAAW,GAapB,CC9Bc,SAAUO,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,OAAOC,GACR,CACH,CCXgB,SAAAC,EAAOC,EAAgBC,GACrC,OAAOD,IAAUC,CACnB,CAEyBC,EAAAA,QAAQH,GCIjCI,EAAAA,QAAQC,OAAO,CAAEC,eCHKL,KAAmBM,GACvC,OAAOC,EACLC,EAAQA,SAACF,GAAO,CAACG,EAAMC,KACrB,MAAMC,EAAMlB,EAAYgB,EAAMT,GAC9BU,GAAUC,EAAIxB,KAAMwB,EAAI,IAG9B,EDJwBC,eEHFZ,KAAmBM,GACvC,OLiBAf,EKhBEiB,EAAQA,SAACF,GAAO,CAACG,EAAMC,KACrB,MAAMC,EAAMlB,EAAYgB,EAAMT,GAC9BU,EAASC,EAAIxB,KAAMwB,EAAI,ILgBpBnB,YAAUD,EAAUF,KAHvB,IACJE,CKXF,EFJ+BsB,gBGHRb,KAAmBM,GACxC,OAAOC,EACLC,EAAQA,SAACF,GAAO,CAACG,EAAMC,KAGrBA,EAFYjB,EAAYgB,EAAMT,GAEjBb,KAAMW,IAAqB,IAG9C,EHLuCgB,eIDjBd,KAAmBM,GACvC,IAAIS,EAAe,EAanB,OAZAT,EAAMU,MAAKP,IAOT,GANYhB,EAAYgB,EAAMT,GAEtBb,MACN4B,IAGEE,EAAWA,YAACF,EAXG,GAYjB,OAAO,CACR,IAGI7B,EAAWa,EAAOgB,EAhBJ,GAiBvB"}
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
63
63
|
|
|
64
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike
|
|
64
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike ) { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
65
65
|
|
|
66
66
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
67
67
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("n4s")):"function"==typeof define&&define.amd?define(["n4s"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).n4s)}(this,(function(t){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){if(!("string"==typeof t||t instanceof String)){var r=n(t);throw null===t?r="null":"object"===r&&(r=t.constructor.name),new TypeError("Expected a string but received a ".concat(r))}}function e(t){return r(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function i(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],e=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(r.push(a.value),!n||r.length!==n);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==u.return||u.return()}finally{if(o)throw i}}return r}(t,n)||a(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,n){if(t){if("string"==typeof t)return u(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,n):void 0}}function u(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("n4s")):"function"==typeof define&&define.amd?define(["n4s"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).n4s)}(this,(function(t){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t){if(!("string"==typeof t||t instanceof String)){var r=n(t);throw null===t?r="null":"object"===r&&(r=t.constructor.name),new TypeError("Expected a string but received a ".concat(r))}}function e(t){return r(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function i(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],e=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(e=(a=u.next()).done)&&(r.push(a.value),!n||r.length!==n);e=!0);}catch(t){o=!0,i=t}finally{try{e||null==u.return||u.return()}finally{if(o)throw i}}return r}(t,n)||a(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,n){if(t){if("string"==typeof t)return u(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,n):void 0}}function u(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var c={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1};var f=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,d=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,l=function(t){var n=t.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);if(n){var r=Number(n[1]),e=Number(n[2]);return r%4==0&&r%100!=0||r%400==0?e<=366:e<=365}var o=t.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number),i=o[1],a=o[2],u=o[3],c=a?"0".concat(a).slice(-2):a,f=u?"0".concat(u).slice(-2):u,d=new Date("".concat(i,"-").concat(c||"01","-").concat(f||"01"));return!a||!u||d.getUTCFullYear()===i&&d.getUTCMonth()+1===a&&d.getUTCDate()===u};t.enforce.extend({isAfter:function(t,n){var r=e((null==n?void 0:n.comparisonDate)||n||Date().toString()),o=e(t);return!!(o&&r&&o>r)},isBefore:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);r(t);var o=e(n),i=e(t);return!!(i&&o&&i<o)},isDate:function(t,n){if(n=o("string"==typeof n?{format:n}:n,c),"string"==typeof t&&(v=n.format,/(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(v))){var r,e=n.delimiters.find((function(t){return-1!==n.format.indexOf(t)})),u=n.strictMode?e:n.delimiters.find((function(n){return-1!==t.indexOf(n)})),f=function(t,n){for(var r=[],e=Math.min(t.length,n.length),o=0;o<e;o++)r.push([t[o],n[o]]);return r}(t.split(u),n.format.toLowerCase().split(e)),d={},l=function(t,n){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=a(t))||n){r&&(t=r);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw i}}}}(f);try{for(l.s();!(r=l.n()).done;){var s=i(r.value,2),y=s[0],m=s[1];if(y.length!==m.length)return!1;d[m.charAt(0)]=y}}catch(t){l.e(t)}finally{l.f()}return new Date("".concat(d.m,"/").concat(d.d,"/").concat(d.y)).getDate()===+d.d}var v;return!n.strictMode&&("[object Date]"===Object.prototype.toString.call(t)&&isFinite(t))},isISO8601:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(t);var e=n.strictSeparator?d.test(t):f.test(t);return e&&n.strict?l(t):e}})}));
|
|
2
2
|
//# sourceMappingURL=date.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.production.js","sources":["../../src/exports/date.ts"],"sourcesContent":["import { enforce } from 'n4s';\nimport isAfter from 'validator/es/lib/isAfter';\nimport isBefore from 'validator/es/lib/isBefore';\nimport isDate from 'validator/es/lib/isDate';\nimport isISO8601 from 'validator/es/lib/isISO8601';\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\n\nenforce.extend({ isAfter, isBefore, isDate, isISO8601 });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isAfter: EnforceCustomMatcher<typeof isAfter, R>;\n isBefore: EnforceCustomMatcher<typeof isBefore, R>;\n isDate: EnforceCustomMatcher<typeof isDate, R>;\n isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;\n }\n }\n}\n"],"names":["enforce","extend","isAfter","isBefore","isDate","isISO8601"],"mappings":"82FAQAA,EAAAA,QAAQC,OAAO,CAAEC,mHAASC,+IAAUC,
|
|
1
|
+
{"version":3,"file":"date.production.js","sources":["../../src/exports/date.ts"],"sourcesContent":["import { enforce } from 'n4s';\nimport isAfter from 'validator/es/lib/isAfter';\nimport isBefore from 'validator/es/lib/isBefore';\nimport isDate from 'validator/es/lib/isDate';\nimport isISO8601 from 'validator/es/lib/isISO8601';\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\n\nenforce.extend({ isAfter, isBefore, isDate, isISO8601 });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isAfter: EnforceCustomMatcher<typeof isAfter, R>;\n isBefore: EnforceCustomMatcher<typeof isBefore, R>;\n isDate: EnforceCustomMatcher<typeof isDate, R>;\n isISO8601: EnforceCustomMatcher<typeof isISO8601, R>;\n }\n }\n}\n"],"names":["enforce","extend","isAfter","isBefore","isDate","isISO8601"],"mappings":"82FAQAA,EAAAA,QAAQC,OAAO,CAAEC,mHAASC,+IAAUC,q8CAAQC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ctx","ruleReturn.passing","isNullish","hasOwnProperty","enforce"],"mappings":";;;;;;EAGc,SAAU,UAAU,CAChC,IAAa,EACb,OAAgB,EAAA;EAEhB,IAAA,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.development.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/loose.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts","../../src/exports/schema.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n"],"names":["defaultTo","ruleReturn.failing","ruleReturn.defaultToPassing","mapFirst","ctx","ruleReturn.passing","isNullish","hasOwnProperty","enforce"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("n4s"),require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","n4s","vest-utils"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).schema={},n.n4s,n["vest-utils"])}(this,(function(n,t,e){"use strict";function r(n,t){
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("n4s"),require("vest-utils")):"function"==typeof define&&define.amd?define(["exports","n4s","vest-utils"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).schema={},n.n4s,n["vest-utils"])}(this,(function(n,t,e){"use strict";function r(n,t){return{pass:n}}function o(){return r(!1)}function s(){return r(!0)}function u(n,t){try{return n.run(t)}catch(n){return o()}}function i(n,e){for(const r in e){const o=n[r],s=e[r],i=t.ctx.run({value:o,set:!0,meta:{key:r}},(()=>u(s,o)));if(!i.pass)return i}return s()}t.enforce.extend({isArrayOf:function(n,r){return o=e.mapFirst(n,((n,e,o)=>{const s=t.ctx.run({value:n,set:!0,meta:{index:o}},(()=>u(r,n)));e(!s.pass,s)})),e.defaultTo(o,s());var o},loose:i,optional:function(n,t){return e.isNullish(n)?s():u(t,n)},shape:function(n,t){const r=i(n,t);if(!r.pass)return r;for(const r in n)if(!e.hasOwnProperty(t,r))return o();return s()}}),n.partial=function(n){const e={};for(const r in n)e[r]=t.enforce.optional(n[r]);return e}}));
|
|
2
2
|
//# sourceMappingURL=schema.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/loose.ts","../../src/exports/schema.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n"],"names":["ruleReturn","pass","message","
|
|
1
|
+
{"version":3,"file":"schema.production.js","sources":["../../src/lib/ruleReturn.ts","../../src/lib/runLazyRule.ts","../../src/plugins/schema/loose.ts","../../src/exports/schema.ts","../../src/plugins/schema/isArrayOf.ts","../../src/plugins/schema/optional.ts","../../src/plugins/schema/shape.ts","../../src/plugins/schema/partial.ts"],"sourcesContent":["import type { Stringable } from 'vest-utils';\nimport { defaultTo } from 'vest-utils';\n\nexport default function ruleReturn(\n pass: boolean,\n message?: string\n): RuleDetailedResult {\n const output: RuleDetailedResult = { pass };\n\n if (message) {\n output.message = message;\n }\n\n return output;\n}\n\nexport function failing(): RuleDetailedResult {\n return ruleReturn(false);\n}\n\nexport function passing(): RuleDetailedResult {\n return ruleReturn(true);\n}\n\nexport function defaultToFailing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, failing());\n}\n\nexport function defaultToPassing(\n callback: (...args: any[]) => RuleDetailedResult\n): RuleDetailedResult {\n return defaultTo(callback, passing());\n}\n\nexport type RuleReturn =\n | boolean\n | {\n pass: boolean;\n message?: Stringable;\n };\n\nexport type RuleDetailedResult = { pass: boolean; message?: string };\n","import type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\n\nexport default function runLazyRule(\n lazyRule: LazyRuleRunners,\n currentValue: any\n): RuleDetailedResult {\n try {\n return lazyRule.run(currentValue);\n } catch {\n return ruleReturn.failing();\n }\n}\n","import { ctx } from 'n4s';\n\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function loose(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n for (const key in shapeObject) {\n const currentValue = inputObject[key];\n const currentRule = shapeObject[key];\n\n const res = ctx.run({ value: currentValue, set: true, meta: { key } }, () =>\n runLazyRule(currentRule, currentValue)\n );\n\n if (!res.pass) {\n return res;\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n\nimport { EnforceCustomMatcher } from 'enforceUtilityTypes';\nimport { isArrayOf } from 'isArrayOf';\nimport { loose } from 'loose';\nimport { optional } from 'optional';\nimport { shape } from 'shape';\n\nexport { partial } from 'partial';\n\nenforce.extend({ isArrayOf, loose, optional, shape });\n\n/* eslint-disable @typescript-eslint/no-namespace */\ndeclare global {\n namespace n4s {\n interface EnforceCustomMatchers<R> {\n isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;\n loose: EnforceCustomMatcher<typeof loose, R>;\n shape: EnforceCustomMatcher<typeof shape, R>;\n optional: EnforceCustomMatcher<typeof optional, R>;\n }\n }\n}\n","import { ctx } from 'n4s';\nimport { mapFirst } from 'vest-utils';\n\nimport type { LazyRuleRunners } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function isArrayOf(\n inputArray: any[],\n currentRule: LazyRuleRunners\n): RuleDetailedResult {\n return ruleReturn.defaultToPassing(\n mapFirst(inputArray, (currentValue, breakout, index) => {\n const res = ctx.run(\n { value: currentValue, set: true, meta: { index } },\n () => runLazyRule(currentRule, currentValue)\n );\n\n breakout(!res.pass, res);\n })\n );\n}\n","import { isNullish } from 'vest-utils';\n\nimport type { Lazy } from 'genEnforceLazy';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport runLazyRule from 'runLazyRule';\n\nexport function optional(value: any, ruleChain: Lazy): RuleDetailedResult {\n if (isNullish(value)) {\n return ruleReturn.passing();\n }\n return runLazyRule(ruleChain, value);\n}\n","import { hasOwnProperty } from 'vest-utils';\n\nimport { loose } from 'loose';\nimport type { RuleDetailedResult } from 'ruleReturn';\nimport * as ruleReturn from 'ruleReturn';\nimport type { ShapeObject } from 'schemaTypes';\n\nexport function shape(\n inputObject: Record<string, any>,\n shapeObject: ShapeObject\n): RuleDetailedResult {\n const baseRes = loose(inputObject, shapeObject);\n if (!baseRes.pass) {\n return baseRes;\n }\n for (const key in inputObject) {\n if (!hasOwnProperty(shapeObject, key)) {\n return ruleReturn.failing();\n }\n }\n\n return ruleReturn.passing();\n}\n","import { enforce } from 'n4s';\n\n// Help needed improving the typings of this file.\n// Ideally, we'd be able to extend ShapeObject, but that's not possible.\nexport function partial<T extends Record<any, any>>(shapeObject: T): T {\n const output = {} as T;\n for (const key in shapeObject) {\n output[key] = enforce.optional(shapeObject[key]) as T[Extract<\n keyof T,\n string\n >];\n }\n return output;\n}\n"],"names":["ruleReturn","pass","message","failing","passing","runLazyRule","lazyRule","currentValue","run","_a","ruleReturn.failing","loose","inputObject","shapeObject","key","currentRule","res","ctx","value","set","meta","ruleReturn.passing","enforce","extend","isArrayOf","inputArray","callback","mapFirst","breakout","index","defaultTo","optional","ruleChain","isNullish","shape","baseRes","hasOwnProperty","output"],"mappings":"gUAGc,SAAUA,EACtBC,EACAC,GAQA,MANmC,CAAED,OAOvC,UAEgBE,IACd,OAAOH,GAAW,EACpB,UAEgBI,IACd,OAAOJ,GAAW,EACpB,CClBc,SAAUK,EACtBC,EACAC,GAEA,IACE,OAAOD,EAASE,IAAID,EAGrB,CAFC,MAAME,GACN,OAAOC,GACR,CACH,CCNgB,SAAAC,EACdC,EACAC,GAEA,IAAK,MAAMC,KAAOD,EAAa,CAC7B,MAAMN,EAAeK,EAAYE,GAC3BC,EAAcF,EAAYC,GAE1BE,EAAMC,EAAAA,IAAIT,IAAI,CAAEU,MAAOX,EAAcY,KAAK,EAAMC,KAAM,CAAEN,SAAS,IACrET,EAAYU,EAAaR,KAG3B,IAAKS,EAAIf,KACP,OAAOe,CAEV,CAED,OAAOK,GACT,CCdAC,EAAAA,QAAQC,OAAO,CAAEC,UCHD,SACdC,EACAV,GAEA,OJmBAW,EIlBEC,EAAAA,SAASF,GAAY,CAAClB,EAAcqB,EAAUC,KAC5C,MAAMb,EAAMC,EAAAA,IAAIT,IACd,CAAEU,MAAOX,EAAcY,KAAK,EAAMC,KAAM,CAAES,WAC1C,IAAMxB,EAAYU,EAAaR,KAGjCqB,GAAUZ,EAAIf,KAAMe,EAAI,IJcrBc,YAAUJ,EAAUtB,KAHvB,IACJsB,CITF,EDX4Bf,QAAOoB,SEJnB,SAASb,EAAYc,GACnC,OAAIC,EAAAA,UAAUf,GACLG,IAEFhB,EAAY2B,EAAWd,EAChC,EFD6CgB,MGJ7B,SACdtB,EACAC,GAEA,MAAMsB,EAAUxB,EAAMC,EAAaC,GACnC,IAAKsB,EAAQlC,KACX,OAAOkC,EAET,IAAK,MAAMrB,KAAOF,EAChB,IAAKwB,EAAcA,eAACvB,EAAaC,GAC/B,OAAOJ,IAIX,OAAOW,GACT,cClBM,SAA8CR,GAClD,MAAMwB,EAAS,CAAA,EACf,IAAK,MAAMvB,KAAOD,EAChBwB,EAAOvB,GAAOQ,EAAOA,QAACS,SAASlB,EAAYC,IAK7C,OAAOuB,CACT"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.0.
|
|
2
|
+
"version": "5.0.25-dev-20240617-b233",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "./dist/cjs/n4s.js",
|
|
5
5
|
"types": "./types/n4s.d.ts",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"release": "vx release"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"context": "
|
|
25
|
-
"vest-utils": "
|
|
24
|
+
"context": "3.0.30-dev-20240617-b233",
|
|
25
|
+
"vest-utils": "1.2.14-dev-20240617-b233"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/validator": "^13.11.
|
|
28
|
+
"@types/validator": "^13.11.10",
|
|
29
29
|
"validator": "13.9.0"
|
|
30
30
|
},
|
|
31
31
|
"vxAllowResolve": [
|