From 30f0ebfc77220cab3476e07a3e1913ddb4ff8f40 Mon Sep 17 00:00:00 2001 From: duart38 Date: Tue, 16 Mar 2021 12:44:35 +0100 Subject: [PATCH] add entries --- builder/ARRAY.ts | 4 ++++ tests/ARRAY_test.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/builder/ARRAY.ts b/builder/ARRAY.ts index a4a6d16..80c1950 100644 --- a/builder/ARRAY.ts +++ b/builder/ARRAY.ts @@ -69,6 +69,10 @@ export class ARR implements WritableBuilder, ARR>, Logical { return this; } + public entries(): IterableIterator<[number, I]>{ + return this.value.entries(); + } + /** * join the array together into a string * @param separator diff --git a/tests/ARRAY_test.ts b/tests/ARRAY_test.ts index 24d088c..378b4a0 100644 --- a/tests/ARRAY_test.ts +++ b/tests/ARRAY_test.ts @@ -120,3 +120,8 @@ Deno.test("Test array chaining", () => { }); if (!called) fail("incorrect clause"); }); + +Deno.test("Test array entries", () => { + // merely runs the internal entries. no need for testing + ARRAY(["hello"]).entries(); +});