riducers 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "riducers",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Dynamic reducers with insert, delete, replace, clear, and sort actions on 'id' based list of objects",
5
5
  "main": "dist/index.js",
6
6
  "module": "esm/index.js",
package/src/index.ts CHANGED
@@ -178,6 +178,7 @@ function reducerBuilder(key: string, opts?: ReducerOpts) {
178
178
  else if (isMap) return mapDeleteReducer(state, {payload, keyName});
179
179
  return objDeleteReducer();
180
180
  } else if (op === "clear") {
181
+ if (opts && opts?.initialState !== undefined) return opts?.initialState;
181
182
  if (isList) return listClearReducer()
182
183
  else if (isMap) return mapClearReducer();
183
184
  return objClearReducer();