Regenerate schema

This commit is contained in:
Tony Garnock-Jones 2021-03-11 14:43:58 +01:00
parent c8f564aea4
commit c09032f609
1 changed files with 34 additions and 30 deletions

View File

@ -96,7 +96,7 @@ export function isSchema(v: any): v is Schema {
let _tmp0, _tmp1: any; let _tmp0, _tmp1: any;
return ( return (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $schema && _.is(v.label, $schema) &&
( (
(v.length === 1) && (v.length === 1) &&
( (
@ -119,36 +119,36 @@ export function isSchema(v: any): v is Schema {
); );
} }
export function asSchema(v: any): Schema {if (!isSchema(v)) {throw new TypeError("Schema");} else {return v;};} export function asSchema(v: any): Schema {if (!isSchema(v)) {throw new TypeError("Invalid Schema");} else {return v;};}
export function isVersion(v: any): v is Version {return v === $1;} export function isVersion(v: any): v is Version {return _.is(v, $1);}
export function asVersion(v: any): Version {if (!isVersion(v)) {throw new TypeError("Version");} else {return v;};} export function asVersion(v: any): Version {if (!isVersion(v)) {throw new TypeError("Invalid Version");} else {return v;};}
export function isPattern(v: any): v is Pattern { export function isPattern(v: any): v is Pattern {
return ( return (
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $atom && _.is(v.label, $atom) &&
( (
(v.length === 1) && (v.length === 1) &&
( (
v[0] === $Boolean || _.is(v[0], $Boolean) ||
v[0] === $Float || _.is(v[0], $Float) ||
v[0] === $Double || _.is(v[0], $Double) ||
v[0] === $SignedInteger || _.is(v[0], $SignedInteger) ||
v[0] === $String || _.is(v[0], $String) ||
v[0] === $ByteString || _.is(v[0], $ByteString) ||
v[0] === $Symbol _.is(v[0], $Symbol)
) )
) )
) || ) ||
(_.Record.isRecord(v) && v.label === $pointer && ((v.length === 0))) || (_.Record.isRecord(v) && _.is(v.label, $pointer) && ((v.length === 0))) ||
(_.Record.isRecord(v) && v.label === $lit && ((v.length === 1) && true)) || (_.Record.isRecord(v) && _.is(v.label, $lit) && ((v.length === 1) && true)) ||
isRef(v) || isRef(v) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $or && _.is(v.label, $or) &&
( (
(v.length === 1) && (v.length === 1) &&
( (
@ -161,7 +161,7 @@ export function isPattern(v: any): v is Pattern {
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $and && _.is(v.label, $and) &&
( (
(v.length === 1) && (v.length === 1) &&
( (
@ -174,12 +174,12 @@ export function isPattern(v: any): v is Pattern {
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $rec && _.is(v.label, $rec) &&
((v.length === 2) && isPattern(v[0]) && isPattern(v[1])) ((v.length === 2) && isPattern(v[0]) && isPattern(v[1]))
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $tuple && _.is(v.label, $tuple) &&
( (
(v.length === 1) && (v.length === 1) &&
( (
@ -192,7 +192,7 @@ export function isPattern(v: any): v is Pattern {
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $tuple_STAR_ && _.is(v.label, $tuple_STAR_) &&
( (
(v.length === 2) && (v.length === 2) &&
( (
@ -206,17 +206,17 @@ export function isPattern(v: any): v is Pattern {
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $setof && _.is(v.label, $setof) &&
((v.length === 1) && isPattern(v[0])) ((v.length === 1) && isPattern(v[0]))
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $dictof && _.is(v.label, $dictof) &&
((v.length === 2) && isPattern(v[0]) && isPattern(v[1])) ((v.length === 2) && isPattern(v[0]) && isPattern(v[1]))
) || ) ||
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $dict && _.is(v.label, $dict) &&
( (
(v.length === 1) && (v.length === 1) &&
( (
@ -231,13 +231,13 @@ export function isPattern(v: any): v is Pattern {
); );
} }
export function asPattern(v: any): Pattern {if (!isPattern(v)) {throw new TypeError("Pattern");} else {return v;};} export function asPattern(v: any): Pattern {if (!isPattern(v)) {throw new TypeError("Invalid Pattern");} else {return v;};}
export function isNamedPattern(v: any): v is NamedPattern { export function isNamedPattern(v: any): v is NamedPattern {
return ( return (
( (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $named && _.is(v.label, $named) &&
((v.length === 2) && typeof v[0] === 'symbol' && isPattern(v[1])) ((v.length === 2) && typeof v[0] === 'symbol' && isPattern(v[1]))
) || ) ||
isPattern(v) isPattern(v)
@ -245,22 +245,24 @@ export function isNamedPattern(v: any): v is NamedPattern {
} }
export function asNamedPattern(v: any): NamedPattern { export function asNamedPattern(v: any): NamedPattern {
if (!isNamedPattern(v)) {throw new TypeError("NamedPattern");} else {return v;}; if (!isNamedPattern(v)) {throw new TypeError("Invalid NamedPattern");} else {return v;};
} }
export function isRef(v: any): v is Ref { export function isRef(v: any): v is Ref {
return ( return (
_.Record.isRecord(v) && _.Record.isRecord(v) &&
v.label === $ref && _.is(v.label, $ref) &&
((v.length === 2) && isModuleRef(v[0]) && typeof v[1] === 'symbol') ((v.length === 2) && isModuleRef(v[0]) && typeof v[1] === 'symbol')
); );
} }
export function asRef(v: any): Ref {if (!isRef(v)) {throw new TypeError("Ref");} else {return v;};} export function asRef(v: any): Ref {if (!isRef(v)) {throw new TypeError("Invalid Ref");} else {return v;};}
export function isModuleRef(v: any): v is ModuleRef {return (v === $thisModule || isModulePath(v));} export function isModuleRef(v: any): v is ModuleRef {return (_.is(v, $thisModule) || isModulePath(v));}
export function asModuleRef(v: any): ModuleRef {if (!isModuleRef(v)) {throw new TypeError("ModuleRef");} else {return v;};} export function asModuleRef(v: any): ModuleRef {
if (!isModuleRef(v)) {throw new TypeError("Invalid ModuleRef");} else {return v;};
}
export function isModulePath(v: any): v is ModulePath { export function isModulePath(v: any): v is ModulePath {
return ( return (
@ -271,5 +273,7 @@ export function isModulePath(v: any): v is ModulePath {
); );
} }
export function asModulePath(v: any): ModulePath {if (!isModulePath(v)) {throw new TypeError("ModulePath");} else {return v;};} export function asModulePath(v: any): ModulePath {
if (!isModulePath(v)) {throw new TypeError("Invalid ModulePath");} else {return v;};
}