Skip to content

Commit 065ed5d

Browse files
committed
v3.0.7
1 parent 5f52112 commit 065ed5d

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

lib/index.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,44 @@
33
Object.defineProperty(exports, "__esModule", {
44
value: true
55
});
6+
exports.DEFAULT_SETTINGS = void 0;
67
exports.createActionType = createActionType;
78
exports.createRoutine = createRoutine;
8-
exports["default"] = exports.DEFAULT_SETTINGS = void 0;
9-
9+
exports["default"] = void 0;
1010
var _reduxActions = require("redux-actions");
11-
12-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13-
11+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1415
// Default routine settings
1516
var DEFAULT_SETTINGS = {
1617
separator: '/',
1718
stages: ['TRIGGER', 'REQUEST', 'SUCCESS', 'FAILURE', 'FULFILL']
18-
}; // Routine action type factory
19+
};
1920

21+
// Routine action type factory
2022
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
21-
2223
function createActionType(prefix, stage, separator) {
2324
if (typeof prefix !== 'string' || typeof stage !== 'string') {
2425
throw new Error('Invalid routine prefix or stage. It should be string.');
2526
}
26-
2727
return "".concat(prefix).concat(separator).concat(stage);
28-
} // Routine factory
29-
28+
}
3029

30+
// Routine factory
3131
function createRoutine(prefix, payloadCreator, metaCreator, settings) {
3232
var _Object$assign = Object.assign({}, DEFAULT_SETTINGS, settings),
33-
stages = _Object$assign.stages,
34-
separator = _Object$assign.separator;
35-
33+
stages = _Object$assign.stages,
34+
separator = _Object$assign.separator;
3635
var createRoutineAction = function createRoutineAction(stage) {
3736
var type = createActionType(prefix, stage, separator);
3837
return (0, _reduxActions.createAction)(type, payloadCreator, metaCreator);
3938
};
40-
4139
return stages.reduce(function (routine, stage) {
4240
var _Object$assign2;
43-
4441
var actionCreator = createRoutineAction(stage);
4542
return Object.assign(routine, (_Object$assign2 = {}, _defineProperty(_Object$assign2, stage.toLowerCase(), actionCreator), _defineProperty(_Object$assign2, stage.toUpperCase(), actionCreator.toString()), _Object$assign2));
4643
}, createRoutineAction(stages[0]));
4744
}
48-
4945
var _default = createRoutine;
5046
exports["default"] = _default;

lib/index.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
"use strict";
22

33
var _index = require("./index");
4-
5-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
6-
4+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
75
var stages = _index.DEFAULT_SETTINGS.stages;
86
describe('createRoutine', function () {
97
it('should be a function', function () {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-routines",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"description": "Simple, yet effective tool for removing Redux boilerplate code.",
55
"keywords": [
66
"redux",

0 commit comments

Comments
 (0)