riducers 1.0.2 → 1.0.3

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 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "riducers",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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
@@ -130,7 +130,6 @@ interface ReducerOpts {
130
130
  stateType?: 'list' | 'map' | 'static';
131
131
  sort?: SortFn;
132
132
  keyName?: string;
133
- initialState?: any;
134
133
  }
135
134
 
136
135
  const OPS = ['insert', 'replace', 'delete', 'clear', 'sort'];
@@ -140,7 +139,7 @@ function reducerBuilder(key: string, opts?: ReducerOpts) {
140
139
  let isMap = opts && opts?.stateType === 'map';
141
140
  let rx = new RegExp(`^${key}/([^\/]+)$`);
142
141
  let m = action.type.match(rx);
143
- if (!m) return state || opts?.initialState !== undefined ? opts?.initialState : (isList ? [] : isMap ? {} : null);
142
+ if (!m) return state || (isList ? [] : isMap ? {} : null);
144
143
 
145
144
  let op = m[1];
146
145
  let payload = action.payload;