@eknkc/dux
Advanced tools
Comparing version 1.1.1 to 2.0.0
37
build.js
@@ -7,5 +7,2 @@ 'use strict'; | ||
exports.Immutable = undefined; | ||
exports.M = M; | ||
exports.L = L; | ||
exports.S = S; | ||
exports.createAction = createAction; | ||
@@ -15,31 +12,9 @@ exports.createReducer = createReducer; | ||
var _immutable = require('immutable'); | ||
var _seamlessImmutable = require('seamless-immutable'); | ||
var _immutable2 = _interopRequireDefault(_immutable); | ||
var _seamlessImmutable2 = _interopRequireDefault(_seamlessImmutable); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.Immutable = _immutable2.default; | ||
function M() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return new (Function.prototype.bind.apply(_immutable2.default.Map, [null].concat(args)))(); | ||
} | ||
function L() { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return new (Function.prototype.bind.apply(_immutable2.default.List, [null].concat(args)))(); | ||
} | ||
function S() { | ||
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
} | ||
return new (Function.prototype.bind.apply(_immutable2.default.Set, [null].concat(args)))(); | ||
} | ||
exports.Immutable = _seamlessImmutable2.default; | ||
function createAction(name) { | ||
@@ -69,3 +44,3 @@ var mapper = arguments.length <= 1 || arguments[1] === undefined ? function (x) { | ||
if (!_immutable2.default.Iterable.isIterable(state)) state = _immutable2.default.fromJS(state); | ||
if (!_seamlessImmutable2.default.isImmutable(state)) state = (0, _seamlessImmutable2.default)(state); | ||
@@ -75,3 +50,3 @@ if (action && action.type && reducers[action.type]) { | ||
if (!_immutable2.default.Iterable.isIterable(state)) throw new TypeError('Reducers must return Immutable objects.'); | ||
if (!_seamlessImmutable2.default.isImmutable(state)) throw new TypeError('Reducers must return Immutable objects.'); | ||
} | ||
@@ -85,3 +60,3 @@ | ||
return function () { | ||
var state = arguments.length <= 0 || arguments[0] === undefined ? new _immutable2.default.Map() : arguments[0]; | ||
var state = arguments.length <= 0 || arguments[0] === undefined ? (0, _seamlessImmutable2.default)({}) : arguments[0]; | ||
var action = arguments[1]; | ||
@@ -88,0 +63,0 @@ |
14
index.js
@@ -1,9 +0,5 @@ | ||
import Immutable from 'immutable' | ||
import Immutable from 'seamless-immutable' | ||
export { Immutable }; | ||
export function M(...args) { return new Immutable.Map(...args) } | ||
export function L(...args) { return new Immutable.List(...args) } | ||
export function S(...args) { return new Immutable.Set(...args) } | ||
export function createAction(name, mapper = x => x) { | ||
@@ -26,4 +22,4 @@ var symbol = Symbol(name); | ||
return function(state = defState, action) { | ||
if (!Immutable.Iterable.isIterable(state)) | ||
state = Immutable.fromJS(state); | ||
if (!Immutable.isImmutable(state)) | ||
state = Immutable(state); | ||
@@ -33,3 +29,3 @@ if (action && action.type && reducers[action.type]) { | ||
if (!Immutable.Iterable.isIterable(state)) | ||
if (!Immutable.isImmutable(state)) | ||
throw new TypeError('Reducers must return Immutable objects.'); | ||
@@ -43,3 +39,3 @@ } | ||
export function combineReducers(reducers) { | ||
return function(state = new Immutable.Map(), action) { | ||
return function(state = Immutable({}), action) { | ||
Object.keys(reducers).forEach(rkey => { | ||
@@ -46,0 +42,0 @@ let oldState = state.get(rkey); |
{ | ||
"name": "@eknkc/dux", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Redux helpers", | ||
@@ -21,4 +21,4 @@ "main": "build.js", | ||
"dependencies": { | ||
"immutable": "^3.7.6" | ||
"seamless-immutable": "^6.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4059
89
+ Addedseamless-immutable@^6.0.0
+ Addedseamless-immutable@6.3.0(transitive)
- Removedimmutable@^3.7.6
- Removedimmutable@3.8.2(transitive)