mol_data_all
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -9,2 +9,9 @@ declare namespace $ { } | ||
declare namespace $ { | ||
function $mol_data_setup<Value extends $mol_data_value, Config = never>(value: Value, config: Config): Value & { | ||
config: Config; | ||
Value: ReturnType<Value>; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_fail(error: any): never; | ||
@@ -18,3 +25,6 @@ } | ||
declare namespace $ { | ||
function $mol_data_array<Sub extends $mol_data_value>(sub: Sub): (val: readonly Parameters<Sub>[0][]) => readonly ReturnType<Sub>[]; | ||
function $mol_data_array<Sub extends $mol_data_value>(sub: Sub): ((val: readonly Parameters<Sub>[0][]) => readonly ReturnType<Sub>[]) & { | ||
config: Sub; | ||
Value: readonly ReturnType<Sub>[]; | ||
}; | ||
} | ||
@@ -27,3 +37,6 @@ | ||
declare namespace $ { | ||
function $mol_data_const<Val>(ref: Val): (val: Val) => Val; | ||
function $mol_data_const<Val>(ref: Val): ((val: Val) => Val) & { | ||
config: Val; | ||
Value: Val; | ||
}; | ||
} | ||
@@ -36,11 +49,20 @@ | ||
declare namespace $ { | ||
function $mol_data_pattern(pattern: RegExp): (val: string) => string; | ||
function $mol_data_pattern(pattern: RegExp): ((val: string) => string) & { | ||
config: RegExp; | ||
Value: string; | ||
}; | ||
} | ||
declare namespace $ { | ||
let $mol_data_email: (val: string) => string; | ||
let $mol_data_email: ((val: string) => string) & { | ||
config: RegExp; | ||
Value: string; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_instance<Instance extends new (...args: any[]) => any>(Instance: Instance): (val: InstanceType<Instance>) => InstanceType<Instance>; | ||
function $mol_data_instance<Instance extends new (...args: any[]) => any>(Instance: Instance): ((val: InstanceType<Instance>) => InstanceType<Instance>) & { | ||
config: Instance; | ||
Value: InstanceType<Instance>; | ||
}; | ||
} | ||
@@ -67,17 +89,73 @@ | ||
declare namespace $ { | ||
function $mol_data_optional<Sub extends $mol_data_value>(sub: Sub): (val: Parameters<Sub>[0]) => ReturnType<Sub>; | ||
function $mol_data_optional<Sub extends $mol_data_value>(sub: Sub): ((val: Parameters<Sub>[0] | undefined) => ReturnType<Sub> | undefined) & { | ||
config: Sub; | ||
Value: ReturnType<Sub> | undefined; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_record<Sub extends Record<string, any>>(sub: Sub): (val: { [key in keyof Sub]: Parameters<Sub[key]>[0]; }) => { readonly [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }; | ||
/** | ||
* Reqursive converts intersection of records to record of intersections | ||
* | ||
* // { a : 1 & 2 } | ||
* $mol_type_merge< { a : 1 } & { b : 2 } > | ||
*/ | ||
type $mol_type_merge<Intersection> = keyof Intersection extends string ? { | ||
[Key in keyof Intersection]: $mol_type_merge<Intersection[Key]>; | ||
} : Intersection; | ||
} | ||
declare namespace $ { | ||
function $mol_data_variant<Sub extends $mol_data_value[]>(...sub: Sub): (val: Parameters<Sub[number]>[0]) => ReturnType<Sub[number]>; | ||
/** | ||
* Extracts keys from `Input` which values extends `Upper`, but not extends `Lower`. | ||
* | ||
* type MathConstants = $mol_type_keys_extract< Math , never , number > // "E" | "PI" ... | ||
*/ | ||
type $mol_type_keys_extract<Input, Lower, Upper> = { | ||
[Field in keyof Input]: Lower extends Input[Field] ? never : Input[Field] extends Upper ? Field : never; | ||
}[keyof Input]; | ||
} | ||
declare namespace $ { | ||
/** | ||
* Picks keys from `Input` which values extends `Upper`, but not `Lower`. | ||
* | ||
* type MathConstants = $mol_type_pick< Math , never , number > // { E , PI , ... } | ||
*/ | ||
type $mol_type_pick<Input, Lower, Upper> = Pick<Input, $mol_type_keys_extract<Input, Lower, Upper>>; | ||
} | ||
declare namespace $ { | ||
/** | ||
* Fields that can be set to undefined makes optional | ||
* | ||
* type User = $mol_type_partial_undefined<{ name : string , age : number | undefined }> // { name : string , age? : number | undefined } | ||
*/ | ||
type $mol_type_partial_undefined<Val> = $mol_type_merge<Partial<Val> & $mol_type_pick<Val, undefined, unknown>>; | ||
} | ||
declare namespace $ { | ||
function $mol_data_record<Sub extends Record<string, $mol_data_value<any>>>(sub: Sub): ((val: $mol_type_merge<Partial<{ [key in keyof Sub]: Parameters<Sub[key]>[0]; }> & Pick<{ [key in keyof Sub]: Parameters<Sub[key]>[0]; }, { [Field in keyof { [key in keyof Sub]: Parameters<Sub[key]>[0]; }]: undefined extends { [key in keyof Sub]: Parameters<Sub[key]>[0]; }[Field] ? never : { [key in keyof Sub]: Parameters<Sub[key]>[0]; }[Field] extends unknown ? Field : never; }[keyof Sub]>>) => Readonly<$mol_type_merge<Partial<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }> & Pick<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }, { [Field_1 in keyof { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }]: undefined extends { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] ? never : { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] extends unknown ? Field_1 : never; }[keyof Sub]>>>) & { | ||
config: Sub; | ||
Value: Readonly<$mol_type_merge<Partial<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }> & Pick<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }, { [Field_1 in keyof { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }]: undefined extends { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] ? never : { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] extends unknown ? Field_1 : never; }[keyof Sub]>>>; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_variant<Sub extends $mol_data_value[]>(...sub: Sub): ((val: Parameters<Sub[number]>[0]) => ReturnType<Sub[number]>) & { | ||
config: Sub; | ||
Value: ReturnType<Sub[number]>; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_wrapper<Pre extends $mol_data_value, Obj extends { | ||
new (val: ReturnType<Pre>): any; | ||
}>(pre: Pre, Obj: Obj): (val: Parameters<Pre>[0]) => InstanceType<Obj>; | ||
}>(pre: Pre, Obj: Obj): ((val: Parameters<Pre>[0]) => InstanceType<Obj>) & { | ||
config: { | ||
pre: Pre; | ||
Obj: Obj; | ||
}; | ||
Value: InstanceType<Obj>; | ||
}; | ||
} |
@@ -1,1 +0,1 @@ | ||
{"files":["mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/index.html","mol/LICENSE","mol/mol.meta.tree","mol/mol.node.jam.js","mol/mol.ts","mol/readme.md","mol/data/readme.md","mol/data/value/value.ts","mol/fail/fail.ts","mol/fail/hidden/hidden.ts","mol/data/array/array.ts","mol/data/boolean/boolean.ts","mol/data/const/const.ts","mol/data/string/string.ts","mol/data/pattern/pattern.ts","mol/data/email/email.ts","mol/data/instance/instance.ts","mol/data/number/number.ts","mol/data/integer/integer.ts","mol/data/nominal/nominal.ts","mol/data/optional/optional.ts","mol/data/record/record.ts","mol/data/variant/variant.ts","mol/data/wrapper/wrapper.ts","mol/data/all/all.meta.tree"],"edgesIn":{"mol/data":{"mol/data/all":{"priority":-9007199254740991},"mol/data/array":{"priority":-9007199254740991},"mol/data/value":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-9007199254740991},"mol/data/const":{"priority":-9007199254740991},"mol/data/email":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-9007199254740991},"mol/data/string":{"priority":-9007199254740991},"mol/data/instance":{"priority":-9007199254740991},"mol/data/integer":{"priority":-9007199254740991},"mol/data/number":{"priority":-9007199254740991},"mol/data/nominal":{"priority":-9007199254740991},"mol/data/optional":{"priority":-9007199254740991},"mol/data/record":{"priority":-9007199254740991},"mol/data/variant":{"priority":-9007199254740991},"mol/data/wrapper":{"priority":-9007199254740991}},"mol":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-9007199254740991}},"mol/data/array":{"mol/data/all":{"priority":-9000}},"mol/data/value":{"mol/data/array":{"priority":-1},"mol/data/nominal":{"priority":-2},"mol/data/optional":{"priority":-1},"mol/data/variant":{"priority":-1},"mol/data/wrapper":{"priority":-2}},"mol/fail":{"mol/data/array":{"priority":-3},"mol/fail/hidden":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-2},"mol/data/const":{"priority":-3},"mol/data/string":{"priority":-2},"mol/data/pattern":{"priority":-3},"mol/data/instance":{"priority":-3},"mol/data/number":{"priority":-2},"mol/data/integer":{"priority":-2},"mol/data/variant":{"priority":-3}},"mol/fail/hidden":{"mol/data/array":{"priority":-5},"mol/data/record":{"priority":-5}},"mol/data/boolean":{"mol/data/all":{"priority":-9000}},"mol/data/const":{"mol/data/all":{"priority":-9000}},"mol/data/email":{"mol/data/all":{"priority":-9000}},"mol/data/pattern":{"mol/data/email":{"priority":-1},"mol/data/all":{"priority":-9000}},"mol/data/string":{"mol/data/pattern":{"priority":-3},"mol/data/all":{"priority":-9000}},"mol/data/instance":{"mol/data/all":{"priority":-9000}},"mol/data/integer":{"mol/data/all":{"priority":-9000}},"mol/data/number":{"mol/data/integer":{"priority":-2},"mol/data/all":{"priority":-9000}},"mol/data/nominal":{"mol/data/all":{"priority":-9000}},"mol/data/optional":{"mol/data/all":{"priority":-9000}},"mol/data/record":{"mol/data/all":{"priority":-9000}},"mol/data/variant":{"mol/data/all":{"priority":-9000}},"mol/data/wrapper":{"mol/data/all":{"priority":-9000}}},"edgesOut":{"mol/data/all":{"mol/data":{"priority":-9007199254740991},"mol/data/array":{"priority":-9000},"mol/data/boolean":{"priority":-9000},"mol/data/const":{"priority":-9000},"mol/data/email":{"priority":-9000},"mol/data/instance":{"priority":-9000},"mol/data/integer":{"priority":-9000},"mol/data/nominal":{"priority":-9000},"mol/data/number":{"priority":-9000},"mol/data/optional":{"priority":-9000},"mol/data/pattern":{"priority":-9000},"mol/data/record":{"priority":-9000},"mol/data/string":{"priority":-9000},"mol/data/variant":{"priority":-9000},"mol/data/wrapper":{"priority":-9000}},"mol/data":{"mol":{"priority":-9007199254740991}},"mol/data/array":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/fail":{"priority":-3},"mol/fail/hidden":{"priority":-5}},"mol/data/value":{"mol/data":{"priority":-9007199254740991}},"mol/fail":{"mol":{"priority":-9007199254740991}},"mol/fail/hidden":{"mol/fail":{"priority":-9007199254740991}},"mol/data/boolean":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/const":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-3}},"mol/data/email":{"mol/data":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-1}},"mol/data/pattern":{"mol/data":{"priority":-9007199254740991},"mol/data/string":{"priority":-3},"mol/fail":{"priority":-3}},"mol/data/string":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/instance":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-3}},"mol/data/integer":{"mol/data":{"priority":-9007199254740991},"mol/data/number":{"priority":-2},"mol/fail":{"priority":-2}},"mol/data/number":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/nominal":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}},"mol/data/optional":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1}},"mol/data/record":{"mol/data":{"priority":-9007199254740991},"mol/fail/hidden":{"priority":-5}},"mol/data/variant":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/fail":{"priority":-3}},"mol/data/wrapper":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}}},"sloc":{"CNAME":1,"md":458,"html":1,"LICENSE":17,"tree":16,"js":10,"ts":145},"deps":{"mol/data/all":{"..":-9007199254740991,"/mol/data/array":-9000,"/mol/data/boolean":-9000,"/mol/data/const":-9000,"/mol/data/email":-9000,"/mol/data/instance":-9000,"/mol/data/integer":-9000,"/mol/data/nominal":-9000,"/mol/data/number":-9000,"/mol/data/optional":-9000,"/mol/data/pattern":-9000,"/mol/data/record":-9000,"/mol/data/string":-9000,"/mol/data/variant":-9000,"/mol/data/wrapper":-9000},"mol/data":{"..":-9007199254740991},"mol":{"..":-9007199254740991,"/mol":0},"mol/data/array":{"..":-9007199254740991,"/mol/data/array":-1,"/mol/data/value":-1,"/mol/fail":-3,"/mol/fail/hidden":-5},"mol/data/value":{"..":-9007199254740991,"/mol/data/value":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/fail/hidden":{"..":-9007199254740991,"/mol/fail/hidden":-1},"mol/data/boolean":{"..":-9007199254740991,"/mol/data/boolean":-1,"/mol/fail":-2},"mol/data/const":{"..":-9007199254740991,"/mol/data/const":-1,"/mol/fail":-3},"mol/data/email":{"..":-9007199254740991,"/mol/data/email":-1,"/mol/data/pattern":-1},"mol/data/pattern":{"..":-9007199254740991,"/mol/data/pattern":-1,"/mol/data/string":-3,"/mol/fail":-3},"mol/data/string":{"..":-9007199254740991,"/mol/data/string":-1,"/mol/fail":-2},"mol/data/instance":{"..":-9007199254740991,"/mol/data/instance":-1,"/mol/fail":-3},"mol/data/integer":{"..":-9007199254740991,"/mol/data/integer":-1,"/mol/data/number":-2,"/mol/fail":-2},"mol/data/number":{"..":-9007199254740991,"/mol/data/number":-1,"/mol/fail":-2},"mol/data/nominal":{"..":-9007199254740991,"/mol/data/nominal":-1,"/mol/data/value":-2},"mol/data/optional":{"..":-9007199254740991,"/mol/data/optional":-1,"/mol/data/value":-1},"mol/data/record":{"..":-9007199254740991,"/mol/data/record":-1,"/mol/fail/hidden":-5},"mol/data/variant":{"..":-9007199254740991,"/mol/data/variant":-1,"/mol/data/value":-1,"/mol/fail":-3},"mol/data/wrapper":{"..":-9007199254740991,"/mol/data/wrapper":-1,"/mol/data/value":-2}}} | ||
{"files":["mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/index.html","mol/LICENSE","mol/mol.meta.tree","mol/mol.node.jam.js","mol/mol.ts","mol/readme.md","mol/data/readme.md","mol/data/value/value.ts","mol/data/setup/setup.ts","mol/fail/fail.ts","mol/fail/hidden/hidden.ts","mol/data/array/array.ts","mol/data/boolean/boolean.ts","mol/data/const/const.ts","mol/data/string/string.ts","mol/data/pattern/pattern.ts","mol/data/email/email.ts","mol/data/instance/instance.ts","mol/data/number/number.ts","mol/data/integer/integer.ts","mol/data/nominal/nominal.ts","mol/data/optional/optional.ts","mol/type/readme.md","mol/type/merge/merge.ts","mol/type/keys/extract/extract.ts","mol/type/pick/pick.ts","mol/type/partial/undefined/undefined.ts","mol/data/record/record.ts","mol/data/variant/variant.ts","mol/data/wrapper/wrapper.ts","mol/data/all/all.meta.tree"],"edgesIn":{"mol/data":{"mol/data/all":{"priority":-9007199254740991},"mol/data/array":{"priority":-9007199254740991},"mol/data/value":{"priority":-9007199254740991},"mol/data/setup":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-9007199254740991},"mol/data/const":{"priority":-9007199254740991},"mol/data/email":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-9007199254740991},"mol/data/string":{"priority":-9007199254740991},"mol/data/instance":{"priority":-9007199254740991},"mol/data/integer":{"priority":-9007199254740991},"mol/data/number":{"priority":-9007199254740991},"mol/data/nominal":{"priority":-9007199254740991},"mol/data/optional":{"priority":-9007199254740991},"mol/data/record":{"priority":-9007199254740991},"mol/data/variant":{"priority":-9007199254740991},"mol/data/wrapper":{"priority":-9007199254740991}},"mol":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-9007199254740991},"mol/type":{"priority":-9007199254740991}},"mol/data/array":{"mol/data/all":{"priority":-9000}},"mol/data/value":{"mol/data/array":{"priority":-1},"mol/data/setup":{"priority":-2},"mol/data/nominal":{"priority":-2},"mol/data/optional":{"priority":-1},"mol/data/record":{"priority":-1},"mol/data/variant":{"priority":-1},"mol/data/wrapper":{"priority":-2}},"mol/data/setup":{"mol/data/array":{"priority":-2},"mol/data/const":{"priority":-2},"mol/data/pattern":{"priority":-2},"mol/data/instance":{"priority":-2},"mol/data/optional":{"priority":-2},"mol/data/record":{"priority":-2},"mol/data/variant":{"priority":-2},"mol/data/wrapper":{"priority":-2}},"mol/fail":{"mol/data/array":{"priority":-3},"mol/fail/hidden":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-2},"mol/data/const":{"priority":-3},"mol/data/string":{"priority":-2},"mol/data/pattern":{"priority":-3},"mol/data/instance":{"priority":-3},"mol/data/number":{"priority":-2},"mol/data/integer":{"priority":-2},"mol/data/variant":{"priority":-3}},"mol/fail/hidden":{"mol/data/array":{"priority":-5},"mol/data/record":{"priority":-5}},"mol/data/boolean":{"mol/data/all":{"priority":-9000}},"mol/data/const":{"mol/data/all":{"priority":-9000}},"mol/data/email":{"mol/data/all":{"priority":-9000}},"mol/data/pattern":{"mol/data/email":{"priority":-1},"mol/data/all":{"priority":-9000}},"mol/data/string":{"mol/data/pattern":{"priority":-3},"mol/data/all":{"priority":-9000}},"mol/data/instance":{"mol/data/all":{"priority":-9000}},"mol/data/integer":{"mol/data/all":{"priority":-9000}},"mol/data/number":{"mol/data/integer":{"priority":-2},"mol/data/all":{"priority":-9000}},"mol/data/nominal":{"mol/data/all":{"priority":-9000}},"mol/data/optional":{"mol/data/all":{"priority":-9000}},"mol/data/record":{"mol/data/all":{"priority":-9000}},"mol/type/partial/undefined":{"mol/data/record":{"priority":-2}},"mol/type/partial":{"mol/type/partial/undefined":{"priority":-9007199254740991}},"mol/type":{"mol/type/partial":{"priority":-9007199254740991},"mol/type/merge":{"priority":-9007199254740991},"mol/type/pick":{"priority":-9007199254740991},"mol/type/keys":{"priority":-9007199254740991}},"mol/type/merge":{"mol/type/partial/undefined":{"priority":-1}},"mol/type/pick":{"mol/type/partial/undefined":{"priority":-2}},"mol/type/keys/extract":{"mol/type/pick":{"priority":-3}},"mol/type/keys":{"mol/type/keys/extract":{"priority":-9007199254740991}},"mol/data/variant":{"mol/data/all":{"priority":-9000}},"mol/data/wrapper":{"mol/data/all":{"priority":-9000}}},"edgesOut":{"mol/data/all":{"mol/data":{"priority":-9007199254740991},"mol/data/array":{"priority":-9000},"mol/data/boolean":{"priority":-9000},"mol/data/const":{"priority":-9000},"mol/data/email":{"priority":-9000},"mol/data/instance":{"priority":-9000},"mol/data/integer":{"priority":-9000},"mol/data/nominal":{"priority":-9000},"mol/data/number":{"priority":-9000},"mol/data/optional":{"priority":-9000},"mol/data/pattern":{"priority":-9000},"mol/data/record":{"priority":-9000},"mol/data/string":{"priority":-9000},"mol/data/variant":{"priority":-9000},"mol/data/wrapper":{"priority":-9000}},"mol/data":{"mol":{"priority":-9007199254740991}},"mol/data/array":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3},"mol/fail/hidden":{"priority":-5}},"mol/data/value":{"mol/data":{"priority":-9007199254740991}},"mol/data/setup":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}},"mol/fail":{"mol":{"priority":-9007199254740991}},"mol/fail/hidden":{"mol/fail":{"priority":-9007199254740991}},"mol/data/boolean":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/const":{"mol/data":{"priority":-9007199254740991},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3}},"mol/data/email":{"mol/data":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-1}},"mol/data/pattern":{"mol/data":{"priority":-9007199254740991},"mol/data/setup":{"priority":-2},"mol/data/string":{"priority":-3},"mol/fail":{"priority":-3}},"mol/data/string":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/instance":{"mol/data":{"priority":-9007199254740991},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3}},"mol/data/integer":{"mol/data":{"priority":-9007199254740991},"mol/data/number":{"priority":-2},"mol/fail":{"priority":-2}},"mol/data/number":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/nominal":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}},"mol/data/optional":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/data/setup":{"priority":-2}},"mol/data/record":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/type/partial/undefined":{"priority":-2},"mol/data/setup":{"priority":-2},"mol/fail/hidden":{"priority":-5}},"mol/type/partial/undefined":{"mol/type/partial":{"priority":-9007199254740991},"mol/type/merge":{"priority":-1},"mol/type/pick":{"priority":-2}},"mol/type/partial":{"mol/type":{"priority":-9007199254740991}},"mol/type":{"mol":{"priority":-9007199254740991}},"mol/type/merge":{"mol/type":{"priority":-9007199254740991}},"mol/type/pick":{"mol/type":{"priority":-9007199254740991},"mol/type/keys/extract":{"priority":-3}},"mol/type/keys/extract":{"mol/type/keys":{"priority":-9007199254740991}},"mol/type/keys":{"mol/type":{"priority":-9007199254740991}},"mol/data/variant":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3}},"mol/data/wrapper":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2},"mol/data/setup":{"priority":-2}}},"sloc":{"CNAME":1,"md":488,"html":1,"LICENSE":17,"tree":16,"js":10,"ts":222},"deps":{"mol/data/all":{"..":-9007199254740991,"/mol/data/array":-9000,"/mol/data/boolean":-9000,"/mol/data/const":-9000,"/mol/data/email":-9000,"/mol/data/instance":-9000,"/mol/data/integer":-9000,"/mol/data/nominal":-9000,"/mol/data/number":-9000,"/mol/data/optional":-9000,"/mol/data/pattern":-9000,"/mol/data/record":-9000,"/mol/data/string":-9000,"/mol/data/variant":-9000,"/mol/data/wrapper":-9000},"mol/data":{"..":-9007199254740991},"mol":{"..":-9007199254740991,"/mol":0},"mol/data/array":{"..":-9007199254740991,"/mol/data/array":-1,"/mol/data/value":-1,"/mol/data/setup":-2,"/mol/fail":-3,"/mol/fail/hidden":-5},"mol/data/value":{"..":-9007199254740991,"/mol/data/value":-1},"mol/data/setup":{"..":-9007199254740991,"/mol/data/setup":-1,"/mol/data/value":-2},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/fail/hidden":{"..":-9007199254740991,"/mol/fail/hidden":-1},"mol/data/boolean":{"..":-9007199254740991,"/mol/data/boolean":-1,"/mol/fail":-2},"mol/data/const":{"..":-9007199254740991,"/mol/data/const":-1,"/mol/data/setup":-2,"/mol/fail":-3},"mol/data/email":{"..":-9007199254740991,"/mol/data/email":-1,"/mol/data/pattern":-1},"mol/data/pattern":{"..":-9007199254740991,"/mol/data/pattern":-1,"/mol/data/setup":-2,"/mol/data/string":-3,"/mol/fail":-3},"mol/data/string":{"..":-9007199254740991,"/mol/data/string":-1,"/mol/fail":-2},"mol/data/instance":{"..":-9007199254740991,"/mol/data/instance":-1,"/mol/data/setup":-2,"/mol/fail":-3},"mol/data/integer":{"..":-9007199254740991,"/mol/data/integer":-1,"/mol/data/number":-2,"/mol/fail":-2},"mol/data/number":{"..":-9007199254740991,"/mol/data/number":-1,"/mol/fail":-2},"mol/data/nominal":{"..":-9007199254740991,"/mol/data/nominal":-1,"/mol/data/value":-2},"mol/data/optional":{"..":-9007199254740991,"/mol/data/optional":-1,"/mol/data/value":-1,"/mol/data/setup":-2},"mol/data/record":{"..":-9007199254740991,"/mol/data/record":-1,"/mol/data/value":-1,"/mol/type/partial/undefined":-2,"/mol/data/setup":-2,"/mol/fail/hidden":-5},"mol/type/partial/undefined":{"..":-9007199254740991,"/mol/type/partial/undefined":-1,"/mol/type/merge":-1,"/mol/type/pick":-2},"mol/type/partial":{"..":-9007199254740991},"mol/type":{"..":-9007199254740991},"mol/type/merge":{"..":-9007199254740991,"/mol/type/merge":-1},"mol/type/pick":{"..":-9007199254740991,"/mol/type/pick":-1,"/mol/type/keys/extract":-3},"mol/type/keys/extract":{"..":-9007199254740991,"/mol/type/keys/extract":-1},"mol/type/keys":{"..":-9007199254740991},"mol/data/variant":{"..":-9007199254740991,"/mol/data/variant":-1,"/mol/data/value":-1,"/mol/data/setup":-2,"/mol/fail":-3},"mol/data/wrapper":{"..":-9007199254740991,"/mol/data/wrapper":-1,"/mol/data/value":-2,"/mol/data/setup":-2}}} |
@@ -35,2 +35,15 @@ require( "source-map-support" ).install(); var exports = void 0; | ||
(function ($) { | ||
function $mol_data_setup(value, config) { | ||
return Object.assign(value, { | ||
config, | ||
Value: null | ||
}); | ||
} | ||
$.$mol_data_setup = $mol_data_setup; | ||
})($ || ($ = {})); | ||
//setup.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_fail(error) { | ||
@@ -57,3 +70,3 @@ throw error; | ||
function $mol_data_array(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (!Array.isArray(val)) | ||
@@ -69,3 +82,3 @@ return $.$mol_fail(new Error('is not an array')); | ||
}); | ||
}; | ||
}, sub); | ||
} | ||
@@ -92,7 +105,7 @@ $.$mol_data_array = $mol_data_array; | ||
function $mol_data_const(ref) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (Object.is(val, ref)) | ||
return ref; | ||
return $.$mol_fail(new Error(`is not ${ref}`)); | ||
}; | ||
}, ref); | ||
} | ||
@@ -119,3 +132,3 @@ $.$mol_data_const = $mol_data_const; | ||
function $mol_data_pattern(pattern) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const val2 = $.$mol_data_string(val); | ||
@@ -125,3 +138,3 @@ if (pattern.test(val2)) | ||
return $.$mol_fail(new Error(`is not a ${pattern}`)); | ||
}; | ||
}, pattern); | ||
} | ||
@@ -143,7 +156,7 @@ $.$mol_data_pattern = $mol_data_pattern; | ||
function $mol_data_instance(Instance) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val instanceof Instance) | ||
return val; | ||
return $.$mol_fail(new Error(`is not a ${Instance.name}`)); | ||
}; | ||
}, Instance); | ||
} | ||
@@ -194,7 +207,7 @@ $.$mol_data_instance = $mol_data_instance; | ||
function $mol_data_optional(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val === undefined) | ||
return undefined; | ||
return sub(val); | ||
}; | ||
}, sub); | ||
} | ||
@@ -206,6 +219,18 @@ $.$mol_data_optional = $mol_data_optional; | ||
"use strict"; | ||
//merge.js.map | ||
; | ||
"use strict"; | ||
//extract.js.map | ||
; | ||
"use strict"; | ||
//pick.js.map | ||
; | ||
"use strict"; | ||
//undefined.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_data_record(sub) { | ||
return ((val) => { | ||
return $.$mol_data_setup((val) => { | ||
let res = {}; | ||
@@ -221,3 +246,3 @@ for (const field in sub) { | ||
return res; | ||
}); | ||
}, sub); | ||
} | ||
@@ -232,3 +257,3 @@ $.$mol_data_record = $mol_data_record; | ||
function $mol_data_variant(...sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const errors = []; | ||
@@ -244,3 +269,3 @@ for (const type of sub) { | ||
return $.$mol_fail(new Error(errors.join(' and '))); | ||
}; | ||
}, sub); | ||
} | ||
@@ -255,3 +280,3 @@ $.$mol_data_variant = $mol_data_variant; | ||
function $mol_data_wrapper(pre, Obj) { | ||
return (val) => new Obj(pre(val)); | ||
return $.$mol_data_setup((val) => new Obj(pre(val)), { pre, Obj }); | ||
} | ||
@@ -258,0 +283,0 @@ $.$mol_data_wrapper = $mol_data_wrapper; |
55
node.js
@@ -35,2 +35,15 @@ require( "source-map-support" ).install(); var exports = void 0; | ||
(function ($) { | ||
function $mol_data_setup(value, config) { | ||
return Object.assign(value, { | ||
config, | ||
Value: null | ||
}); | ||
} | ||
$.$mol_data_setup = $mol_data_setup; | ||
})($ || ($ = {})); | ||
//setup.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_fail(error) { | ||
@@ -57,3 +70,3 @@ throw error; | ||
function $mol_data_array(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (!Array.isArray(val)) | ||
@@ -69,3 +82,3 @@ return $.$mol_fail(new Error('is not an array')); | ||
}); | ||
}; | ||
}, sub); | ||
} | ||
@@ -92,7 +105,7 @@ $.$mol_data_array = $mol_data_array; | ||
function $mol_data_const(ref) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (Object.is(val, ref)) | ||
return ref; | ||
return $.$mol_fail(new Error(`is not ${ref}`)); | ||
}; | ||
}, ref); | ||
} | ||
@@ -119,3 +132,3 @@ $.$mol_data_const = $mol_data_const; | ||
function $mol_data_pattern(pattern) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const val2 = $.$mol_data_string(val); | ||
@@ -125,3 +138,3 @@ if (pattern.test(val2)) | ||
return $.$mol_fail(new Error(`is not a ${pattern}`)); | ||
}; | ||
}, pattern); | ||
} | ||
@@ -143,7 +156,7 @@ $.$mol_data_pattern = $mol_data_pattern; | ||
function $mol_data_instance(Instance) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val instanceof Instance) | ||
return val; | ||
return $.$mol_fail(new Error(`is not a ${Instance.name}`)); | ||
}; | ||
}, Instance); | ||
} | ||
@@ -194,7 +207,7 @@ $.$mol_data_instance = $mol_data_instance; | ||
function $mol_data_optional(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val === undefined) | ||
return undefined; | ||
return sub(val); | ||
}; | ||
}, sub); | ||
} | ||
@@ -206,6 +219,18 @@ $.$mol_data_optional = $mol_data_optional; | ||
"use strict"; | ||
//merge.js.map | ||
; | ||
"use strict"; | ||
//extract.js.map | ||
; | ||
"use strict"; | ||
//pick.js.map | ||
; | ||
"use strict"; | ||
//undefined.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_data_record(sub) { | ||
return ((val) => { | ||
return $.$mol_data_setup((val) => { | ||
let res = {}; | ||
@@ -221,3 +246,3 @@ for (const field in sub) { | ||
return res; | ||
}); | ||
}, sub); | ||
} | ||
@@ -232,3 +257,3 @@ $.$mol_data_record = $mol_data_record; | ||
function $mol_data_variant(...sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const errors = []; | ||
@@ -244,3 +269,3 @@ for (const type of sub) { | ||
return $.$mol_fail(new Error(errors.join(' and '))); | ||
}; | ||
}, sub); | ||
} | ||
@@ -255,3 +280,3 @@ $.$mol_data_variant = $mol_data_variant; | ||
function $mol_data_wrapper(pre, Obj) { | ||
return (val) => new Obj(pre(val)); | ||
return $.$mol_data_setup((val) => new Obj(pre(val)), { pre, Obj }); | ||
} | ||
@@ -258,0 +283,0 @@ $.$mol_data_wrapper = $mol_data_wrapper; |
{ | ||
"name": "mol_data_all", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "node.js", | ||
@@ -5,0 +5,0 @@ "module": "node.esm.js", |
96
web.d.ts
@@ -9,2 +9,9 @@ declare namespace $ { } | ||
declare namespace $ { | ||
function $mol_data_setup<Value extends $mol_data_value, Config = never>(value: Value, config: Config): Value & { | ||
config: Config; | ||
Value: ReturnType<Value>; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_fail(error: any): never; | ||
@@ -18,3 +25,6 @@ } | ||
declare namespace $ { | ||
function $mol_data_array<Sub extends $mol_data_value>(sub: Sub): (val: readonly Parameters<Sub>[0][]) => readonly ReturnType<Sub>[]; | ||
function $mol_data_array<Sub extends $mol_data_value>(sub: Sub): ((val: readonly Parameters<Sub>[0][]) => readonly ReturnType<Sub>[]) & { | ||
config: Sub; | ||
Value: readonly ReturnType<Sub>[]; | ||
}; | ||
} | ||
@@ -27,3 +37,6 @@ | ||
declare namespace $ { | ||
function $mol_data_const<Val>(ref: Val): (val: Val) => Val; | ||
function $mol_data_const<Val>(ref: Val): ((val: Val) => Val) & { | ||
config: Val; | ||
Value: Val; | ||
}; | ||
} | ||
@@ -36,11 +49,20 @@ | ||
declare namespace $ { | ||
function $mol_data_pattern(pattern: RegExp): (val: string) => string; | ||
function $mol_data_pattern(pattern: RegExp): ((val: string) => string) & { | ||
config: RegExp; | ||
Value: string; | ||
}; | ||
} | ||
declare namespace $ { | ||
let $mol_data_email: (val: string) => string; | ||
let $mol_data_email: ((val: string) => string) & { | ||
config: RegExp; | ||
Value: string; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_instance<Instance extends new (...args: any[]) => any>(Instance: Instance): (val: InstanceType<Instance>) => InstanceType<Instance>; | ||
function $mol_data_instance<Instance extends new (...args: any[]) => any>(Instance: Instance): ((val: InstanceType<Instance>) => InstanceType<Instance>) & { | ||
config: Instance; | ||
Value: InstanceType<Instance>; | ||
}; | ||
} | ||
@@ -67,17 +89,73 @@ | ||
declare namespace $ { | ||
function $mol_data_optional<Sub extends $mol_data_value>(sub: Sub): (val: Parameters<Sub>[0]) => ReturnType<Sub>; | ||
function $mol_data_optional<Sub extends $mol_data_value>(sub: Sub): ((val: Parameters<Sub>[0] | undefined) => ReturnType<Sub> | undefined) & { | ||
config: Sub; | ||
Value: ReturnType<Sub> | undefined; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_record<Sub extends Record<string, any>>(sub: Sub): (val: { [key in keyof Sub]: Parameters<Sub[key]>[0]; }) => { readonly [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }; | ||
/** | ||
* Reqursive converts intersection of records to record of intersections | ||
* | ||
* // { a : 1 & 2 } | ||
* $mol_type_merge< { a : 1 } & { b : 2 } > | ||
*/ | ||
type $mol_type_merge<Intersection> = keyof Intersection extends string ? { | ||
[Key in keyof Intersection]: $mol_type_merge<Intersection[Key]>; | ||
} : Intersection; | ||
} | ||
declare namespace $ { | ||
function $mol_data_variant<Sub extends $mol_data_value[]>(...sub: Sub): (val: Parameters<Sub[number]>[0]) => ReturnType<Sub[number]>; | ||
/** | ||
* Extracts keys from `Input` which values extends `Upper`, but not extends `Lower`. | ||
* | ||
* type MathConstants = $mol_type_keys_extract< Math , never , number > // "E" | "PI" ... | ||
*/ | ||
type $mol_type_keys_extract<Input, Lower, Upper> = { | ||
[Field in keyof Input]: Lower extends Input[Field] ? never : Input[Field] extends Upper ? Field : never; | ||
}[keyof Input]; | ||
} | ||
declare namespace $ { | ||
/** | ||
* Picks keys from `Input` which values extends `Upper`, but not `Lower`. | ||
* | ||
* type MathConstants = $mol_type_pick< Math , never , number > // { E , PI , ... } | ||
*/ | ||
type $mol_type_pick<Input, Lower, Upper> = Pick<Input, $mol_type_keys_extract<Input, Lower, Upper>>; | ||
} | ||
declare namespace $ { | ||
/** | ||
* Fields that can be set to undefined makes optional | ||
* | ||
* type User = $mol_type_partial_undefined<{ name : string , age : number | undefined }> // { name : string , age? : number | undefined } | ||
*/ | ||
type $mol_type_partial_undefined<Val> = $mol_type_merge<Partial<Val> & $mol_type_pick<Val, undefined, unknown>>; | ||
} | ||
declare namespace $ { | ||
function $mol_data_record<Sub extends Record<string, $mol_data_value<any>>>(sub: Sub): ((val: $mol_type_merge<Partial<{ [key in keyof Sub]: Parameters<Sub[key]>[0]; }> & Pick<{ [key in keyof Sub]: Parameters<Sub[key]>[0]; }, { [Field in keyof { [key in keyof Sub]: Parameters<Sub[key]>[0]; }]: undefined extends { [key in keyof Sub]: Parameters<Sub[key]>[0]; }[Field] ? never : { [key in keyof Sub]: Parameters<Sub[key]>[0]; }[Field] extends unknown ? Field : never; }[keyof Sub]>>) => Readonly<$mol_type_merge<Partial<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }> & Pick<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }, { [Field_1 in keyof { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }]: undefined extends { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] ? never : { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] extends unknown ? Field_1 : never; }[keyof Sub]>>>) & { | ||
config: Sub; | ||
Value: Readonly<$mol_type_merge<Partial<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }> & Pick<{ [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }, { [Field_1 in keyof { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }]: undefined extends { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] ? never : { [key_1 in keyof Sub]: ReturnType<Sub[key_1]>; }[Field_1] extends unknown ? Field_1 : never; }[keyof Sub]>>>; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_variant<Sub extends $mol_data_value[]>(...sub: Sub): ((val: Parameters<Sub[number]>[0]) => ReturnType<Sub[number]>) & { | ||
config: Sub; | ||
Value: ReturnType<Sub[number]>; | ||
}; | ||
} | ||
declare namespace $ { | ||
function $mol_data_wrapper<Pre extends $mol_data_value, Obj extends { | ||
new (val: ReturnType<Pre>): any; | ||
}>(pre: Pre, Obj: Obj): (val: Parameters<Pre>[0]) => InstanceType<Obj>; | ||
}>(pre: Pre, Obj: Obj): ((val: Parameters<Pre>[0]) => InstanceType<Obj>) & { | ||
config: { | ||
pre: Pre; | ||
Obj: Obj; | ||
}; | ||
Value: InstanceType<Obj>; | ||
}; | ||
} |
@@ -1,1 +0,1 @@ | ||
{"files":["mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/index.html","mol/LICENSE","mol/mol.meta.tree","mol/mol.ts","mol/mol.web.jam.js","mol/readme.md","mol/data/readme.md","mol/data/value/value.ts","mol/fail/fail.ts","mol/fail/hidden/hidden.ts","mol/data/array/array.ts","mol/data/boolean/boolean.ts","mol/data/const/const.ts","mol/data/string/string.ts","mol/data/pattern/pattern.ts","mol/data/email/email.ts","mol/data/instance/instance.ts","mol/data/number/number.ts","mol/data/integer/integer.ts","mol/data/nominal/nominal.ts","mol/data/optional/optional.ts","mol/data/record/record.ts","mol/data/variant/variant.ts","mol/data/wrapper/wrapper.ts","mol/data/all/all.meta.tree"],"edgesIn":{"mol/data":{"mol/data/all":{"priority":-9007199254740991},"mol/data/array":{"priority":-9007199254740991},"mol/data/value":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-9007199254740991},"mol/data/const":{"priority":-9007199254740991},"mol/data/email":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-9007199254740991},"mol/data/string":{"priority":-9007199254740991},"mol/data/instance":{"priority":-9007199254740991},"mol/data/integer":{"priority":-9007199254740991},"mol/data/number":{"priority":-9007199254740991},"mol/data/nominal":{"priority":-9007199254740991},"mol/data/optional":{"priority":-9007199254740991},"mol/data/record":{"priority":-9007199254740991},"mol/data/variant":{"priority":-9007199254740991},"mol/data/wrapper":{"priority":-9007199254740991}},"mol":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-9007199254740991}},"mol/data/array":{"mol/data/all":{"priority":-9000}},"mol/data/value":{"mol/data/array":{"priority":-1},"mol/data/nominal":{"priority":-2},"mol/data/optional":{"priority":-1},"mol/data/variant":{"priority":-1},"mol/data/wrapper":{"priority":-2}},"mol/fail":{"mol/data/array":{"priority":-3},"mol/fail/hidden":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-2},"mol/data/const":{"priority":-3},"mol/data/string":{"priority":-2},"mol/data/pattern":{"priority":-3},"mol/data/instance":{"priority":-3},"mol/data/number":{"priority":-2},"mol/data/integer":{"priority":-2},"mol/data/variant":{"priority":-3}},"mol/fail/hidden":{"mol/data/array":{"priority":-5},"mol/data/record":{"priority":-5}},"mol/data/boolean":{"mol/data/all":{"priority":-9000}},"mol/data/const":{"mol/data/all":{"priority":-9000}},"mol/data/email":{"mol/data/all":{"priority":-9000}},"mol/data/pattern":{"mol/data/email":{"priority":-1},"mol/data/all":{"priority":-9000}},"mol/data/string":{"mol/data/pattern":{"priority":-3},"mol/data/all":{"priority":-9000}},"mol/data/instance":{"mol/data/all":{"priority":-9000}},"mol/data/integer":{"mol/data/all":{"priority":-9000}},"mol/data/number":{"mol/data/integer":{"priority":-2},"mol/data/all":{"priority":-9000}},"mol/data/nominal":{"mol/data/all":{"priority":-9000}},"mol/data/optional":{"mol/data/all":{"priority":-9000}},"mol/data/record":{"mol/data/all":{"priority":-9000}},"mol/data/variant":{"mol/data/all":{"priority":-9000}},"mol/data/wrapper":{"mol/data/all":{"priority":-9000}}},"edgesOut":{"mol/data/all":{"mol/data":{"priority":-9007199254740991},"mol/data/array":{"priority":-9000},"mol/data/boolean":{"priority":-9000},"mol/data/const":{"priority":-9000},"mol/data/email":{"priority":-9000},"mol/data/instance":{"priority":-9000},"mol/data/integer":{"priority":-9000},"mol/data/nominal":{"priority":-9000},"mol/data/number":{"priority":-9000},"mol/data/optional":{"priority":-9000},"mol/data/pattern":{"priority":-9000},"mol/data/record":{"priority":-9000},"mol/data/string":{"priority":-9000},"mol/data/variant":{"priority":-9000},"mol/data/wrapper":{"priority":-9000}},"mol/data":{"mol":{"priority":-9007199254740991}},"mol/data/array":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/fail":{"priority":-3},"mol/fail/hidden":{"priority":-5}},"mol/data/value":{"mol/data":{"priority":-9007199254740991}},"mol/fail":{"mol":{"priority":-9007199254740991}},"mol/fail/hidden":{"mol/fail":{"priority":-9007199254740991}},"mol/data/boolean":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/const":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-3}},"mol/data/email":{"mol/data":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-1}},"mol/data/pattern":{"mol/data":{"priority":-9007199254740991},"mol/data/string":{"priority":-3},"mol/fail":{"priority":-3}},"mol/data/string":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/instance":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-3}},"mol/data/integer":{"mol/data":{"priority":-9007199254740991},"mol/data/number":{"priority":-2},"mol/fail":{"priority":-2}},"mol/data/number":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/nominal":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}},"mol/data/optional":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1}},"mol/data/record":{"mol/data":{"priority":-9007199254740991},"mol/fail/hidden":{"priority":-5}},"mol/data/variant":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/fail":{"priority":-3}},"mol/data/wrapper":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}}},"sloc":{"CNAME":1,"md":458,"html":1,"LICENSE":17,"tree":16,"ts":145,"js":10},"deps":{"mol/data/all":{"..":-9007199254740991,"/mol/data/array":-9000,"/mol/data/boolean":-9000,"/mol/data/const":-9000,"/mol/data/email":-9000,"/mol/data/instance":-9000,"/mol/data/integer":-9000,"/mol/data/nominal":-9000,"/mol/data/number":-9000,"/mol/data/optional":-9000,"/mol/data/pattern":-9000,"/mol/data/record":-9000,"/mol/data/string":-9000,"/mol/data/variant":-9000,"/mol/data/wrapper":-9000},"mol/data":{"..":-9007199254740991},"mol":{"..":-9007199254740991,"/mol":0},"mol/data/array":{"..":-9007199254740991,"/mol/data/array":-1,"/mol/data/value":-1,"/mol/fail":-3,"/mol/fail/hidden":-5},"mol/data/value":{"..":-9007199254740991,"/mol/data/value":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/fail/hidden":{"..":-9007199254740991,"/mol/fail/hidden":-1},"mol/data/boolean":{"..":-9007199254740991,"/mol/data/boolean":-1,"/mol/fail":-2},"mol/data/const":{"..":-9007199254740991,"/mol/data/const":-1,"/mol/fail":-3},"mol/data/email":{"..":-9007199254740991,"/mol/data/email":-1,"/mol/data/pattern":-1},"mol/data/pattern":{"..":-9007199254740991,"/mol/data/pattern":-1,"/mol/data/string":-3,"/mol/fail":-3},"mol/data/string":{"..":-9007199254740991,"/mol/data/string":-1,"/mol/fail":-2},"mol/data/instance":{"..":-9007199254740991,"/mol/data/instance":-1,"/mol/fail":-3},"mol/data/integer":{"..":-9007199254740991,"/mol/data/integer":-1,"/mol/data/number":-2,"/mol/fail":-2},"mol/data/number":{"..":-9007199254740991,"/mol/data/number":-1,"/mol/fail":-2},"mol/data/nominal":{"..":-9007199254740991,"/mol/data/nominal":-1,"/mol/data/value":-2},"mol/data/optional":{"..":-9007199254740991,"/mol/data/optional":-1,"/mol/data/value":-1},"mol/data/record":{"..":-9007199254740991,"/mol/data/record":-1,"/mol/fail/hidden":-5},"mol/data/variant":{"..":-9007199254740991,"/mol/data/variant":-1,"/mol/data/value":-1,"/mol/fail":-3},"mol/data/wrapper":{"..":-9007199254740991,"/mol/data/wrapper":-1,"/mol/data/value":-2}}} | ||
{"files":["mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/index.html","mol/LICENSE","mol/mol.meta.tree","mol/mol.ts","mol/mol.web.jam.js","mol/readme.md","mol/data/readme.md","mol/data/value/value.ts","mol/data/setup/setup.ts","mol/fail/fail.ts","mol/fail/hidden/hidden.ts","mol/data/array/array.ts","mol/data/boolean/boolean.ts","mol/data/const/const.ts","mol/data/string/string.ts","mol/data/pattern/pattern.ts","mol/data/email/email.ts","mol/data/instance/instance.ts","mol/data/number/number.ts","mol/data/integer/integer.ts","mol/data/nominal/nominal.ts","mol/data/optional/optional.ts","mol/type/readme.md","mol/type/merge/merge.ts","mol/type/keys/extract/extract.ts","mol/type/pick/pick.ts","mol/type/partial/undefined/undefined.ts","mol/data/record/record.ts","mol/data/variant/variant.ts","mol/data/wrapper/wrapper.ts","mol/data/all/all.meta.tree"],"edgesIn":{"mol/data":{"mol/data/all":{"priority":-9007199254740991},"mol/data/array":{"priority":-9007199254740991},"mol/data/value":{"priority":-9007199254740991},"mol/data/setup":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-9007199254740991},"mol/data/const":{"priority":-9007199254740991},"mol/data/email":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-9007199254740991},"mol/data/string":{"priority":-9007199254740991},"mol/data/instance":{"priority":-9007199254740991},"mol/data/integer":{"priority":-9007199254740991},"mol/data/number":{"priority":-9007199254740991},"mol/data/nominal":{"priority":-9007199254740991},"mol/data/optional":{"priority":-9007199254740991},"mol/data/record":{"priority":-9007199254740991},"mol/data/variant":{"priority":-9007199254740991},"mol/data/wrapper":{"priority":-9007199254740991}},"mol":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-9007199254740991},"mol/type":{"priority":-9007199254740991}},"mol/data/array":{"mol/data/all":{"priority":-9000}},"mol/data/value":{"mol/data/array":{"priority":-1},"mol/data/setup":{"priority":-2},"mol/data/nominal":{"priority":-2},"mol/data/optional":{"priority":-1},"mol/data/record":{"priority":-1},"mol/data/variant":{"priority":-1},"mol/data/wrapper":{"priority":-2}},"mol/data/setup":{"mol/data/array":{"priority":-2},"mol/data/const":{"priority":-2},"mol/data/pattern":{"priority":-2},"mol/data/instance":{"priority":-2},"mol/data/optional":{"priority":-2},"mol/data/record":{"priority":-2},"mol/data/variant":{"priority":-2},"mol/data/wrapper":{"priority":-2}},"mol/fail":{"mol/data/array":{"priority":-3},"mol/fail/hidden":{"priority":-9007199254740991},"mol/data/boolean":{"priority":-2},"mol/data/const":{"priority":-3},"mol/data/string":{"priority":-2},"mol/data/pattern":{"priority":-3},"mol/data/instance":{"priority":-3},"mol/data/number":{"priority":-2},"mol/data/integer":{"priority":-2},"mol/data/variant":{"priority":-3}},"mol/fail/hidden":{"mol/data/array":{"priority":-5},"mol/data/record":{"priority":-5}},"mol/data/boolean":{"mol/data/all":{"priority":-9000}},"mol/data/const":{"mol/data/all":{"priority":-9000}},"mol/data/email":{"mol/data/all":{"priority":-9000}},"mol/data/pattern":{"mol/data/email":{"priority":-1},"mol/data/all":{"priority":-9000}},"mol/data/string":{"mol/data/pattern":{"priority":-3},"mol/data/all":{"priority":-9000}},"mol/data/instance":{"mol/data/all":{"priority":-9000}},"mol/data/integer":{"mol/data/all":{"priority":-9000}},"mol/data/number":{"mol/data/integer":{"priority":-2},"mol/data/all":{"priority":-9000}},"mol/data/nominal":{"mol/data/all":{"priority":-9000}},"mol/data/optional":{"mol/data/all":{"priority":-9000}},"mol/data/record":{"mol/data/all":{"priority":-9000}},"mol/type/partial/undefined":{"mol/data/record":{"priority":-2}},"mol/type/partial":{"mol/type/partial/undefined":{"priority":-9007199254740991}},"mol/type":{"mol/type/partial":{"priority":-9007199254740991},"mol/type/merge":{"priority":-9007199254740991},"mol/type/pick":{"priority":-9007199254740991},"mol/type/keys":{"priority":-9007199254740991}},"mol/type/merge":{"mol/type/partial/undefined":{"priority":-1}},"mol/type/pick":{"mol/type/partial/undefined":{"priority":-2}},"mol/type/keys/extract":{"mol/type/pick":{"priority":-3}},"mol/type/keys":{"mol/type/keys/extract":{"priority":-9007199254740991}},"mol/data/variant":{"mol/data/all":{"priority":-9000}},"mol/data/wrapper":{"mol/data/all":{"priority":-9000}}},"edgesOut":{"mol/data/all":{"mol/data":{"priority":-9007199254740991},"mol/data/array":{"priority":-9000},"mol/data/boolean":{"priority":-9000},"mol/data/const":{"priority":-9000},"mol/data/email":{"priority":-9000},"mol/data/instance":{"priority":-9000},"mol/data/integer":{"priority":-9000},"mol/data/nominal":{"priority":-9000},"mol/data/number":{"priority":-9000},"mol/data/optional":{"priority":-9000},"mol/data/pattern":{"priority":-9000},"mol/data/record":{"priority":-9000},"mol/data/string":{"priority":-9000},"mol/data/variant":{"priority":-9000},"mol/data/wrapper":{"priority":-9000}},"mol/data":{"mol":{"priority":-9007199254740991}},"mol/data/array":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3},"mol/fail/hidden":{"priority":-5}},"mol/data/value":{"mol/data":{"priority":-9007199254740991}},"mol/data/setup":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}},"mol/fail":{"mol":{"priority":-9007199254740991}},"mol/fail/hidden":{"mol/fail":{"priority":-9007199254740991}},"mol/data/boolean":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/const":{"mol/data":{"priority":-9007199254740991},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3}},"mol/data/email":{"mol/data":{"priority":-9007199254740991},"mol/data/pattern":{"priority":-1}},"mol/data/pattern":{"mol/data":{"priority":-9007199254740991},"mol/data/setup":{"priority":-2},"mol/data/string":{"priority":-3},"mol/fail":{"priority":-3}},"mol/data/string":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/instance":{"mol/data":{"priority":-9007199254740991},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3}},"mol/data/integer":{"mol/data":{"priority":-9007199254740991},"mol/data/number":{"priority":-2},"mol/fail":{"priority":-2}},"mol/data/number":{"mol/data":{"priority":-9007199254740991},"mol/fail":{"priority":-2}},"mol/data/nominal":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2}},"mol/data/optional":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/data/setup":{"priority":-2}},"mol/data/record":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/type/partial/undefined":{"priority":-2},"mol/data/setup":{"priority":-2},"mol/fail/hidden":{"priority":-5}},"mol/type/partial/undefined":{"mol/type/partial":{"priority":-9007199254740991},"mol/type/merge":{"priority":-1},"mol/type/pick":{"priority":-2}},"mol/type/partial":{"mol/type":{"priority":-9007199254740991}},"mol/type":{"mol":{"priority":-9007199254740991}},"mol/type/merge":{"mol/type":{"priority":-9007199254740991}},"mol/type/pick":{"mol/type":{"priority":-9007199254740991},"mol/type/keys/extract":{"priority":-3}},"mol/type/keys/extract":{"mol/type/keys":{"priority":-9007199254740991}},"mol/type/keys":{"mol/type":{"priority":-9007199254740991}},"mol/data/variant":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-1},"mol/data/setup":{"priority":-2},"mol/fail":{"priority":-3}},"mol/data/wrapper":{"mol/data":{"priority":-9007199254740991},"mol/data/value":{"priority":-2},"mol/data/setup":{"priority":-2}}},"sloc":{"CNAME":1,"md":488,"html":1,"LICENSE":17,"tree":16,"ts":222,"js":10},"deps":{"mol/data/all":{"..":-9007199254740991,"/mol/data/array":-9000,"/mol/data/boolean":-9000,"/mol/data/const":-9000,"/mol/data/email":-9000,"/mol/data/instance":-9000,"/mol/data/integer":-9000,"/mol/data/nominal":-9000,"/mol/data/number":-9000,"/mol/data/optional":-9000,"/mol/data/pattern":-9000,"/mol/data/record":-9000,"/mol/data/string":-9000,"/mol/data/variant":-9000,"/mol/data/wrapper":-9000},"mol/data":{"..":-9007199254740991},"mol":{"..":-9007199254740991,"/mol":0},"mol/data/array":{"..":-9007199254740991,"/mol/data/array":-1,"/mol/data/value":-1,"/mol/data/setup":-2,"/mol/fail":-3,"/mol/fail/hidden":-5},"mol/data/value":{"..":-9007199254740991,"/mol/data/value":-1},"mol/data/setup":{"..":-9007199254740991,"/mol/data/setup":-1,"/mol/data/value":-2},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/fail/hidden":{"..":-9007199254740991,"/mol/fail/hidden":-1},"mol/data/boolean":{"..":-9007199254740991,"/mol/data/boolean":-1,"/mol/fail":-2},"mol/data/const":{"..":-9007199254740991,"/mol/data/const":-1,"/mol/data/setup":-2,"/mol/fail":-3},"mol/data/email":{"..":-9007199254740991,"/mol/data/email":-1,"/mol/data/pattern":-1},"mol/data/pattern":{"..":-9007199254740991,"/mol/data/pattern":-1,"/mol/data/setup":-2,"/mol/data/string":-3,"/mol/fail":-3},"mol/data/string":{"..":-9007199254740991,"/mol/data/string":-1,"/mol/fail":-2},"mol/data/instance":{"..":-9007199254740991,"/mol/data/instance":-1,"/mol/data/setup":-2,"/mol/fail":-3},"mol/data/integer":{"..":-9007199254740991,"/mol/data/integer":-1,"/mol/data/number":-2,"/mol/fail":-2},"mol/data/number":{"..":-9007199254740991,"/mol/data/number":-1,"/mol/fail":-2},"mol/data/nominal":{"..":-9007199254740991,"/mol/data/nominal":-1,"/mol/data/value":-2},"mol/data/optional":{"..":-9007199254740991,"/mol/data/optional":-1,"/mol/data/value":-1,"/mol/data/setup":-2},"mol/data/record":{"..":-9007199254740991,"/mol/data/record":-1,"/mol/data/value":-1,"/mol/type/partial/undefined":-2,"/mol/data/setup":-2,"/mol/fail/hidden":-5},"mol/type/partial/undefined":{"..":-9007199254740991,"/mol/type/partial/undefined":-1,"/mol/type/merge":-1,"/mol/type/pick":-2},"mol/type/partial":{"..":-9007199254740991},"mol/type":{"..":-9007199254740991},"mol/type/merge":{"..":-9007199254740991,"/mol/type/merge":-1},"mol/type/pick":{"..":-9007199254740991,"/mol/type/pick":-1,"/mol/type/keys/extract":-3},"mol/type/keys/extract":{"..":-9007199254740991,"/mol/type/keys/extract":-1},"mol/type/keys":{"..":-9007199254740991},"mol/data/variant":{"..":-9007199254740991,"/mol/data/variant":-1,"/mol/data/value":-1,"/mol/data/setup":-2,"/mol/fail":-3},"mol/data/wrapper":{"..":-9007199254740991,"/mol/data/wrapper":-1,"/mol/data/value":-2,"/mol/data/setup":-2}}} |
@@ -33,2 +33,15 @@ function require( path ){ return $node[ path ] }; | ||
(function ($) { | ||
function $mol_data_setup(value, config) { | ||
return Object.assign(value, { | ||
config, | ||
Value: null | ||
}); | ||
} | ||
$.$mol_data_setup = $mol_data_setup; | ||
})($ || ($ = {})); | ||
//setup.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_fail(error) { | ||
@@ -55,3 +68,3 @@ throw error; | ||
function $mol_data_array(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (!Array.isArray(val)) | ||
@@ -67,3 +80,3 @@ return $.$mol_fail(new Error('is not an array')); | ||
}); | ||
}; | ||
}, sub); | ||
} | ||
@@ -90,7 +103,7 @@ $.$mol_data_array = $mol_data_array; | ||
function $mol_data_const(ref) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (Object.is(val, ref)) | ||
return ref; | ||
return $.$mol_fail(new Error(`is not ${ref}`)); | ||
}; | ||
}, ref); | ||
} | ||
@@ -117,3 +130,3 @@ $.$mol_data_const = $mol_data_const; | ||
function $mol_data_pattern(pattern) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const val2 = $.$mol_data_string(val); | ||
@@ -123,3 +136,3 @@ if (pattern.test(val2)) | ||
return $.$mol_fail(new Error(`is not a ${pattern}`)); | ||
}; | ||
}, pattern); | ||
} | ||
@@ -141,7 +154,7 @@ $.$mol_data_pattern = $mol_data_pattern; | ||
function $mol_data_instance(Instance) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val instanceof Instance) | ||
return val; | ||
return $.$mol_fail(new Error(`is not a ${Instance.name}`)); | ||
}; | ||
}, Instance); | ||
} | ||
@@ -192,7 +205,7 @@ $.$mol_data_instance = $mol_data_instance; | ||
function $mol_data_optional(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val === undefined) | ||
return undefined; | ||
return sub(val); | ||
}; | ||
}, sub); | ||
} | ||
@@ -204,6 +217,18 @@ $.$mol_data_optional = $mol_data_optional; | ||
"use strict"; | ||
//merge.js.map | ||
; | ||
"use strict"; | ||
//extract.js.map | ||
; | ||
"use strict"; | ||
//pick.js.map | ||
; | ||
"use strict"; | ||
//undefined.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_data_record(sub) { | ||
return ((val) => { | ||
return $.$mol_data_setup((val) => { | ||
let res = {}; | ||
@@ -219,3 +244,3 @@ for (const field in sub) { | ||
return res; | ||
}); | ||
}, sub); | ||
} | ||
@@ -230,3 +255,3 @@ $.$mol_data_record = $mol_data_record; | ||
function $mol_data_variant(...sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const errors = []; | ||
@@ -242,3 +267,3 @@ for (const type of sub) { | ||
return $.$mol_fail(new Error(errors.join(' and '))); | ||
}; | ||
}, sub); | ||
} | ||
@@ -253,3 +278,3 @@ $.$mol_data_variant = $mol_data_variant; | ||
function $mol_data_wrapper(pre, Obj) { | ||
return (val) => new Obj(pre(val)); | ||
return $.$mol_data_setup((val) => new Obj(pre(val)), { pre, Obj }); | ||
} | ||
@@ -256,0 +281,0 @@ $.$mol_data_wrapper = $mol_data_wrapper; |
55
web.js
@@ -33,2 +33,15 @@ function require( path ){ return $node[ path ] }; | ||
(function ($) { | ||
function $mol_data_setup(value, config) { | ||
return Object.assign(value, { | ||
config, | ||
Value: null | ||
}); | ||
} | ||
$.$mol_data_setup = $mol_data_setup; | ||
})($ || ($ = {})); | ||
//setup.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_fail(error) { | ||
@@ -55,3 +68,3 @@ throw error; | ||
function $mol_data_array(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (!Array.isArray(val)) | ||
@@ -67,3 +80,3 @@ return $.$mol_fail(new Error('is not an array')); | ||
}); | ||
}; | ||
}, sub); | ||
} | ||
@@ -90,7 +103,7 @@ $.$mol_data_array = $mol_data_array; | ||
function $mol_data_const(ref) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (Object.is(val, ref)) | ||
return ref; | ||
return $.$mol_fail(new Error(`is not ${ref}`)); | ||
}; | ||
}, ref); | ||
} | ||
@@ -117,3 +130,3 @@ $.$mol_data_const = $mol_data_const; | ||
function $mol_data_pattern(pattern) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const val2 = $.$mol_data_string(val); | ||
@@ -123,3 +136,3 @@ if (pattern.test(val2)) | ||
return $.$mol_fail(new Error(`is not a ${pattern}`)); | ||
}; | ||
}, pattern); | ||
} | ||
@@ -141,7 +154,7 @@ $.$mol_data_pattern = $mol_data_pattern; | ||
function $mol_data_instance(Instance) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val instanceof Instance) | ||
return val; | ||
return $.$mol_fail(new Error(`is not a ${Instance.name}`)); | ||
}; | ||
}, Instance); | ||
} | ||
@@ -192,7 +205,7 @@ $.$mol_data_instance = $mol_data_instance; | ||
function $mol_data_optional(sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
if (val === undefined) | ||
return undefined; | ||
return sub(val); | ||
}; | ||
}, sub); | ||
} | ||
@@ -204,6 +217,18 @@ $.$mol_data_optional = $mol_data_optional; | ||
"use strict"; | ||
//merge.js.map | ||
; | ||
"use strict"; | ||
//extract.js.map | ||
; | ||
"use strict"; | ||
//pick.js.map | ||
; | ||
"use strict"; | ||
//undefined.js.map | ||
; | ||
"use strict"; | ||
var $; | ||
(function ($) { | ||
function $mol_data_record(sub) { | ||
return ((val) => { | ||
return $.$mol_data_setup((val) => { | ||
let res = {}; | ||
@@ -219,3 +244,3 @@ for (const field in sub) { | ||
return res; | ||
}); | ||
}, sub); | ||
} | ||
@@ -230,3 +255,3 @@ $.$mol_data_record = $mol_data_record; | ||
function $mol_data_variant(...sub) { | ||
return (val) => { | ||
return $.$mol_data_setup((val) => { | ||
const errors = []; | ||
@@ -242,3 +267,3 @@ for (const type of sub) { | ||
return $.$mol_fail(new Error(errors.join(' and '))); | ||
}; | ||
}, sub); | ||
} | ||
@@ -253,3 +278,3 @@ $.$mol_data_variant = $mol_data_variant; | ||
function $mol_data_wrapper(pre, Obj) { | ||
return (val) => new Obj(pre(val)); | ||
return $.$mol_data_setup((val) => new Obj(pre(val)), { pre, Obj }); | ||
} | ||
@@ -256,0 +281,0 @@ $.$mol_data_wrapper = $mol_data_wrapper; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
859790
9409