Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions async.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,12 @@ modes.forEach((logic) => {
}
})
expect(answer).toStrictEqual(['a', 'b'])

const answer2 = await logic.run({
keys: 'foo'
})

expect(answer2).toStrictEqual([])
})

test('substr', async () => {
Expand Down
2 changes: 1 addition & 1 deletion defaultMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const defaultMethods = {
'!': (value) => Array.isArray(value) ? !value[0] : !value,
'!!': (value) => Boolean(Array.isArray(value) ? value[0] : value),
cat: (arr) => (typeof arr === 'string' ? arr : arr.join('')),
keys: (obj) => Object.keys(obj),
keys: (obj) => typeof obj === 'object' ? Object.keys(obj) : [],
eachKey: {
traverse: false,
method: (object, context, above, engine) => {
Expand Down
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ modes.forEach((logic) => {
})

expect(answer).toStrictEqual(['a', 'b'])

const answer2 = logic.run({
keys: 'foo'
})

expect(answer2).toStrictEqual([])
})

test('substr', () => {
Expand Down
Loading