From c09032f6095003ae5ac9f931ea64f359040f28d5 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 11 Mar 2021 14:43:58 +0100 Subject: [PATCH] Regenerate schema --- .../packages/schema/src/gen/schema.ts | 64 ++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/implementations/javascript/packages/schema/src/gen/schema.ts b/implementations/javascript/packages/schema/src/gen/schema.ts index 58141d1..299e3de 100644 --- a/implementations/javascript/packages/schema/src/gen/schema.ts +++ b/implementations/javascript/packages/schema/src/gen/schema.ts @@ -96,7 +96,7 @@ export function isSchema(v: any): v is Schema { let _tmp0, _tmp1: any; return ( _.Record.isRecord(v) && - v.label === $schema && + _.is(v.label, $schema) && ( (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 { return ( ( _.Record.isRecord(v) && - v.label === $atom && + _.is(v.label, $atom) && ( (v.length === 1) && ( - v[0] === $Boolean || - v[0] === $Float || - v[0] === $Double || - v[0] === $SignedInteger || - v[0] === $String || - v[0] === $ByteString || - v[0] === $Symbol + _.is(v[0], $Boolean) || + _.is(v[0], $Float) || + _.is(v[0], $Double) || + _.is(v[0], $SignedInteger) || + _.is(v[0], $String) || + _.is(v[0], $ByteString) || + _.is(v[0], $Symbol) ) ) ) || - (_.Record.isRecord(v) && v.label === $pointer && ((v.length === 0))) || - (_.Record.isRecord(v) && v.label === $lit && ((v.length === 1) && true)) || + (_.Record.isRecord(v) && _.is(v.label, $pointer) && ((v.length === 0))) || + (_.Record.isRecord(v) && _.is(v.label, $lit) && ((v.length === 1) && true)) || isRef(v) || ( _.Record.isRecord(v) && - v.label === $or && + _.is(v.label, $or) && ( (v.length === 1) && ( @@ -161,7 +161,7 @@ export function isPattern(v: any): v is Pattern { ) || ( _.Record.isRecord(v) && - v.label === $and && + _.is(v.label, $and) && ( (v.length === 1) && ( @@ -174,12 +174,12 @@ export function isPattern(v: any): v is Pattern { ) || ( _.Record.isRecord(v) && - v.label === $rec && + _.is(v.label, $rec) && ((v.length === 2) && isPattern(v[0]) && isPattern(v[1])) ) || ( _.Record.isRecord(v) && - v.label === $tuple && + _.is(v.label, $tuple) && ( (v.length === 1) && ( @@ -192,7 +192,7 @@ export function isPattern(v: any): v is Pattern { ) || ( _.Record.isRecord(v) && - v.label === $tuple_STAR_ && + _.is(v.label, $tuple_STAR_) && ( (v.length === 2) && ( @@ -206,17 +206,17 @@ export function isPattern(v: any): v is Pattern { ) || ( _.Record.isRecord(v) && - v.label === $setof && + _.is(v.label, $setof) && ((v.length === 1) && isPattern(v[0])) ) || ( _.Record.isRecord(v) && - v.label === $dictof && + _.is(v.label, $dictof) && ((v.length === 2) && isPattern(v[0]) && isPattern(v[1])) ) || ( _.Record.isRecord(v) && - v.label === $dict && + _.is(v.label, $dict) && ( (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 { return ( ( _.Record.isRecord(v) && - v.label === $named && + _.is(v.label, $named) && ((v.length === 2) && typeof v[0] === 'symbol' && isPattern(v[1])) ) || isPattern(v) @@ -245,22 +245,24 @@ export function isNamedPattern(v: any): v is 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 { return ( _.Record.isRecord(v) && - v.label === $ref && + _.is(v.label, $ref) && ((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 { 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;}; +}