Skip to content

Commit c15b144

Browse files
author
Cache Hamm
committed
build 2.0.1
1 parent 37e343f commit c15b144

File tree

3 files changed

+74
-11
lines changed

3 files changed

+74
-11
lines changed

dist/generator-runtime.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
var undefined; // More compressible than void 0.
1717
var $Symbol = typeof Symbol === "function" ? Symbol : {};
1818
var iteratorSymbol = $Symbol.iterator || "@@iterator";
19+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
1920
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
2021

2122
var inModule = typeof module === "object";
@@ -189,8 +190,8 @@
189190
}
190191
}
191192

192-
if (typeof process === "object" && process.domain) {
193-
invoke = process.domain.bind(invoke);
193+
if (typeof global.process === "object" && global.process.domain) {
194+
invoke = global.process.domain.bind(invoke);
194195
}
195196

196197
var previousPromise;
@@ -229,6 +230,9 @@
229230
}
230231

231232
defineIteratorMethods(AsyncIterator.prototype);
233+
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
234+
return this;
235+
};
232236
runtime.AsyncIterator = AsyncIterator;
233237

234238
// Note that simple async functions are implemented on top of
@@ -412,6 +416,15 @@
412416

413417
Gp[toStringTagSymbol] = "Generator";
414418

419+
// A Generator should always return itself as the iterator object when the
420+
// @@iterator function is called on it. Some browsers' implementations of the
421+
// iterator prototype chain incorrectly implement this, causing the Generator
422+
// object to not be returned from this call. This ensures that doesn't happen.
423+
// See https://github.com/facebook/regenerator/issues/274 for more details.
424+
Gp[iteratorSymbol] = function() {
425+
return this;
426+
};
427+
415428
Gp.toString = function() {
416429
return "[object Generator]";
417430
};

dist/rule-result.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8+
9+
var _lodash = require('lodash.clonedeep');
10+
11+
var _lodash2 = _interopRequireDefault(_lodash);
12+
13+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14+
15+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16+
17+
var RuleResult = function () {
18+
function RuleResult(conditions, event, priority) {
19+
_classCallCheck(this, RuleResult);
20+
21+
this.conditions = (0, _lodash2.default)(conditions);
22+
this.event = (0, _lodash2.default)(event);
23+
this.priority = (0, _lodash2.default)(priority);
24+
this.result = null;
25+
}
26+
27+
_createClass(RuleResult, [{
28+
key: 'setResult',
29+
value: function setResult(result) {
30+
this.result = result;
31+
}
32+
}, {
33+
key: 'toJSON',
34+
value: function toJSON() {
35+
var stringify = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
36+
37+
var props = {
38+
conditions: this.conditions.toJSON(false),
39+
event: this.event,
40+
priority: this.priority,
41+
result: this.result
42+
};
43+
if (stringify) {
44+
return JSON.stringify(props);
45+
}
46+
return props;
47+
}
48+
}]);
49+
50+
return RuleResult;
51+
}();
52+
53+
exports.default = RuleResult;

dist/rule.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ var _condition = require('./condition');
1010

1111
var _condition2 = _interopRequireDefault(_condition);
1212

13-
var _events = require('events');
13+
var _ruleResult = require('./rule-result');
1414

15-
var _lodash = require('lodash.clonedeep');
15+
var _ruleResult2 = _interopRequireDefault(_ruleResult);
1616

17-
var _lodash2 = _interopRequireDefault(_lodash);
17+
var _events = require('events');
1818

1919
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2020

@@ -195,11 +195,7 @@ var Rule = function (_EventEmitter) {
195195
while (1) {
196196
switch (_context6.prev = _context6.next) {
197197
case 0:
198-
ruleResult = {
199-
conditions: (0, _lodash2.default)(this.conditions),
200-
event: (0, _lodash2.default)(this.event),
201-
priority: (0, _lodash2.default)(this.priority)
202-
};
198+
ruleResult = new _ruleResult2.default(this.conditions, this.event, this.priority);
203199

204200
/**
205201
* Evaluates the rule conditions
@@ -471,7 +467,8 @@ var Rule = function (_EventEmitter) {
471467

472468

473469
processResult = function processResult(result) {
474-
ruleResult.result = result;
470+
ruleResult.setResult(result);
471+
475472
if (result) _this3.emit('success', ruleResult.event, almanac, ruleResult);else _this3.emit('failure', ruleResult.event, almanac, ruleResult);
476473
return ruleResult;
477474
};

0 commit comments

Comments
 (0)