Skip to content

Commit

Permalink
docs(README): Update eval and evalSync examples with context
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeetbajra committed Sep 18, 2023
1 parent 471f167 commit 543a4a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const context = {
}

// Filter an array asynchronously...
await const res = jexl.eval('assoc[.first == "Lana"].last', context)
const res = await jexl.eval('assoc[.first == "Lana"].last', context)
console.log(res) // Output: Kane

// Or synchronously!
console.log(jexl.evalSync('assoc[.first == "Lana"].last')) // Output: Kane
console.log(jexl.evalSync('assoc[.first == "Lana"].last', context)) // Output: Kane

// Do math
await jexl.eval('age * (3 - 1)', context)
Expand Down

0 comments on commit 543a4a4

Please sign in to comment.