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 _clone = require('clone');
|
10 |
|
11 | var _clone2 = _interopRequireDefault(_clone);
|
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, name) {
|
19 | _classCallCheck(this, RuleResult);
|
20 |
|
21 | this.conditions = (0, _clone2.default)(conditions);
|
22 | this.event = (0, _clone2.default)(event);
|
23 | this.priority = (0, _clone2.default)(priority);
|
24 | this.name = (0, _clone2.default)(name);
|
25 | this.result = null;
|
26 | }
|
27 |
|
28 | _createClass(RuleResult, [{
|
29 | key: 'setResult',
|
30 | value: function setResult(result) {
|
31 | this.result = result;
|
32 | }
|
33 | }, {
|
34 | key: 'toJSON',
|
35 | value: function toJSON() {
|
36 | var stringify = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
37 |
|
38 | var props = {
|
39 | conditions: this.conditions.toJSON(false),
|
40 | event: this.event,
|
41 | priority: this.priority,
|
42 | name: this.name,
|
43 | result: this.result
|
44 | };
|
45 | if (stringify) {
|
46 | return JSON.stringify(props);
|
47 | }
|
48 | return props;
|
49 | }
|
50 | }]);
|
51 |
|
52 | return RuleResult;
|
53 | }();
|
54 |
|
55 | exports.default = RuleResult; |
\ | No newline at end of file |