Skip to content

Commit a31fcbf

Browse files
committed
2.0.1
1 parent a80ea89 commit a31fcbf

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

lib/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ function createAction(type, payload) {
3232
args[_key - 2] = arguments[_key];
3333
}
3434

35-
return Object.assign.apply(Object, args.concat([{
36-
type: type,
37-
payload: payload
38-
}]));
35+
return Object.assign.apply(Object, [{}].concat(args, [{ type: type, payload: payload }]));
3936
}
4037

4138
function createRoutine(prefix) {

lib/index.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ describe('createAction', function () {
115115
test: true
116116
});
117117
});
118+
it('should not mutate action with additional properties', function () {
119+
var type = 'TEST';
120+
var props = { test: true };
121+
var action1 = (0, _index.createAction)('type1', null, props);
122+
var action2 = (0, _index.createAction)('type2', null, props);
123+
expect(action1.type).toContain('type1');
124+
expect(action2.type).toContain('type2');
125+
});
118126
});
119127

120128
describe('prefixType', 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": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Simple, yet effective tool for removing Redux boilerplate code.",
55
"keywords": [
66
"redux",

0 commit comments

Comments
 (0)