Skip to content

Commit

Permalink
maintained scope for a pipe and pipe apply
Browse files Browse the repository at this point in the history
  • Loading branch information
KoryNunn committed Aug 27, 2014
1 parent b73d302 commit b74c332
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 0 additions & 4 deletions gel.js
Expand Up @@ -457,8 +457,6 @@ PipeToken.prototype.parse = function(tokens, position){
this.functionToken = tokens.splice(position,1)[0];
};
PipeToken.prototype.evaluate = function(scope){
scope = new Scope(scope);

if(!this.functionToken){
throw "Invalid function call. No function was provided to execute.";
}
Expand Down Expand Up @@ -486,8 +484,6 @@ PipeApplyToken.prototype.parse = function(tokens, position){
this.functionToken = tokens.splice(position,1)[0];
};
PipeApplyToken.prototype.evaluate = function(scope){
scope = new Scope(scope);

if(!this.functionToken){
throw "Invalid function call. No function was provided to execute.";
}
Expand Down
10 changes: 9 additions & 1 deletion test/index.js
Expand Up @@ -1072,4 +1072,12 @@ test('{"a":1},{"a":2},{"a":3} |> (map _ (* 2 _.a))', function (t) {
[2,4,6]
);
t.end();
});
});
test('(fold "1","2",3 0 (+ _ _|>parseInt))', function (t) {
t.plan(1);
t.deepEqual(
gel.evaluate(t.name, context),
6
);
t.end();
});

0 comments on commit b74c332

Please sign in to comment.