From b15eaa14f5e8055295ba24fa41eabbfd6a8e82a9 Mon Sep 17 00:00:00 2001 From: Rodrigo Quelhas Date: Thu, 10 Mar 2022 10:08:36 +0000 Subject: [PATCH] feat: Make (Big_map, Map) argument optional --- documentation/docs/values.md | 4 ++-- package.json | 2 +- scripts/build.js | 6 +++++- src/literal.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/documentation/docs/values.md b/documentation/docs/values.md index 081aa09..4375d0f 100644 --- a/documentation/docs/values.md +++ b/documentation/docs/values.md @@ -273,7 +273,7 @@ console.log(Unit().toJSON()); // { prim: 'Unit' } ```ts import { Left, Nat } from '@tezwell/michelson-sdk'; -const or_value = Left(Nat(1); +const or_value = Left(Nat(1)); // Micheline console.log(or_value.toMicheline()); // Left 1 @@ -288,7 +288,7 @@ console.log(or_value.toJSON()); // { prim: 'Left', args: [{ int: '1' } ```ts import { Right, Nat } from '@tezwell/michelson-sdk'; -const or_value = Right(Nat(1); +const or_value = Right(Nat(1)); // Micheline console.log(or_value.toMicheline()); // Right 1 diff --git a/package.json b/package.json index c2c61b8..655baea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tezwell/michelson-sdk", - "version": "0.4.1", + "version": "0.4.2", "description": "Michelson SDK is a framework for generating Michelson values and types from Javascript.", "keywords": [ "Tezos", diff --git a/scripts/build.js b/scripts/build.js index 84cb658..a74ece3 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -33,5 +33,9 @@ function generateBundle(entryPoints) { * Clean UP build files */ function cleanUP() { - fs.rmSync(DIST_FOLDER, { recursive: true, force: true }); + try { + fs.rmdirSync(DIST_FOLDER, { recursive: true, force: true }); + } catch { + // Ignore error + } } diff --git a/src/literal.ts b/src/literal.ts index 6e63b39..f4d3945 100644 --- a/src/literal.ts +++ b/src/literal.ts @@ -225,7 +225,7 @@ export const Set = List; export const None = () => new Michelson_Literal(Prim.None); export const Some = (element: IValue) => new Michelson_Literal_C1(Prim.Some, [element]); export const Pair = (left: IValue, right: IValue) => new Michelson_Literal_C1(Prim.Pair, [left, right]); -export const Map = (elements: IValue[][]) => new Michelson_Map(elements); +export const Map = (elements: IValue[][] = []) => new Michelson_Map(elements); export const Big_map = Map; export const Lambda = (code: MichelsonMicheline | MichelsonJSON) => buildLambda(code); export const Left = (value: IValue) => new Michelson_Literal_C1(Prim.Left, [value]);