Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

all the this.goodies for seq{Each,Map} too

  • Loading branch information...
commit f4301b0355f76c7cf522769fcfb1837903c53539 1 parent 3d55791
@substack authored
Showing with 39 additions and 6 deletions.
  1. +39 −6 index.js
View
45 index.js
@@ -266,14 +266,25 @@ function builder (saw, xs) {
self.apply(self, arguments);
};
+ next.stack = self.stack;
+ next.stack_ = self.stack_;
+ next.vars = self.vars;
+ next.args = self.args;
+ next.error = self.error;
+
+ next.into = function (key) {
+ return function () {
+ res[key] = arguments[1];
+ self.apply(self, arguments);
+ };
+ };
+
next.ok = function () {
var args = [].slice.call(arguments);
args.unshift(null);
return next.apply(next, args);
};
- next.stack = self.stack;
-
cb.apply(next, arguments);
})
.seq(function () {
@@ -288,12 +299,34 @@ function builder (saw, xs) {
var len = context.stack.length;
this.seqEach(function (x, i) {
- var self = (function () {
+ var self = this;
+
+ var next = function () {
res[i] = arguments[1];
if (i == len - 1) context.stack = res;
- this.apply(this, arguments);
- }).bind(this);
- cb.apply(self, arguments);
+ self.apply(self, arguments);
+ };
+
+ next.stack = self.stack;
+ next.stack_ = self.stack_;
+ next.vars = self.vars;
+ next.args = self.args;
+ next.error = self.error;
+
+ next.into = function (key) {
+ return function () {
+ res[key] = arguments[1];
+ self.apply(self, arguments);
+ };
+ };
+
+ next.ok = function () {
+ var args = [].slice.call(arguments);
+ args.unshift(null);
+ return next.apply(next, args);
+ };
+
+ cb.apply(next, arguments);
});
};
Please sign in to comment.
Something went wrong with that request. Please try again.