Skip to content

Commit

Permalink
fix: declare args of firts() as nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Apr 5, 2019
1 parent f7a68a9 commit 3e7c0a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/functions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const functions = {
},

first: {
arguments: ["object|number"],
arguments: ["object|number|undefined"],
returns: "object?",
apply: (context, args) => {
args = args.filter(e => e !== undefined && e.value !== undefined);
Expand Down
1 change: 1 addition & 0 deletions tests/basics-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ test("length (string)", async t => t.is(await expand("${length('abc')}"), 3));
test("length (array)", async t => t.is(await expand("${length([1,2,3])}"), 3));

test("first", async t => t.is(await expand("${first(1,2,3)}"), 1));
test.only("first missing", async t => t.is(await expand("${first(env.MISSING,'b')}"), 'b'));

test("split", async t =>
t.deepEqual(await expand("${split('1,2,3,4',',')}"), ["1", "2", "3", "4"]));
Expand Down

0 comments on commit 3e7c0a0

Please sign in to comment.