Skip to content

Commit 219b0d0

Browse files
Merge pull request #36 from horacio-penya/hp_function_check
Fix function check in var method
2 parents 036feec + 853f0dd commit 219b0d0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

async.test.js

+11
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,17 @@ modes.forEach((logic) => {
826826
).toBe(null)
827827
})
828828

829+
test('allow access to objects named as their methods', async () => {
830+
expect(
831+
await logic.run(
832+
{
833+
var: 'toString'
834+
},
835+
{toString: 'hello'}
836+
)
837+
).toBe("hello")
838+
})
839+
829840
test('allow access to functions on objects when enabled', async () => {
830841
logic.allowFunctions = true
831842
expect(

defaultMethods.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ const defaultMethods = {
217217
return notFound
218218
}
219219
}
220-
if (engine.allowFunctions || typeof (context && context[key]) !== 'function') {
220+
if (engine.allowFunctions || typeof context !== 'function') {
221221
return context
222222
}
223223
return null

0 commit comments

Comments
 (0)