actions.js
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict";
require("core-js/modules/es6.object.define-property");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = actions;
require("core-js/modules/es6.function.name");
require("core-js/modules/es6.array.iterator");
require("core-js/modules/es6.object.keys");
require("core-js/modules/web.dom.iterable");
require("core-js/modules/es6.array.for-each");
var _action = _interopRequireDefault(require("./action"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function actions() {
var options = {};
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var names = args; // last argument can be options
if (names.length !== 1 && typeof args[args.length - 1] !== 'string') {
options = names.pop();
}
var namesObject = names[0];
if (names.length !== 1 || typeof namesObject === 'string') {
namesObject = {};
names.forEach(function (name) {
namesObject[name] = name;
});
}
var actionsObject = {};
Object.keys(namesObject).forEach(function (name) {
actionsObject[name] = (0, _action.default)(namesObject[name], options);
});
return actionsObject;
}