Skip to content
Permalink
Browse files

Add @ as map operation prefix

  • Loading branch information
antonmedv committed Jan 8, 2020
1 parent 1744e17 commit 973ceb92da7bf49b55c9dad4b939fdf665b4443c
Showing with 6 additions and 0 deletions.
  1. +6 −0 reduce.js
@@ -13,6 +13,12 @@ function reduce(json, code) {
return Object.keys(json)
}

if (/^@/.test(code)) {
return eval(`function fn() {
return Object.values(this).map(x => x${code.substring(1)})
}; fn`).call(json)
}

if (/^\.\[/.test(code)) {
return eval(`function fn() {
return this${code.substring(1)}

0 comments on commit 973ceb9

Please sign in to comment.
You can’t perform that action at this time.