@kashcode/reduxish 0.2.0 → 0.3.0

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.
package/dist/helpers.js CHANGED
@@ -10,14 +10,11 @@ exports.applyMiddleware = applyMiddleware;
10
10
  * @returns A single root reducer that will manage the global state.
11
11
  */
12
12
  function combineReducers(reducerMap) {
13
- return function (state, action) {
14
- if (state === void 0) { state = {}; }
15
- return (Object.entries(reducerMap)).reduce(function (partialState, _a) {
16
- var key = _a[0], reducer = _a[1];
17
- partialState[key] = reducer(state[key], action);
18
- return partialState;
19
- }, {});
20
- };
13
+ return function (state, action) { return (Object.entries(reducerMap)).reduce(function (partialState, _a) {
14
+ var key = _a[0], reducer = _a[1];
15
+ partialState[key] = reducer(state === null || state === void 0 ? void 0 : state[key], action);
16
+ return partialState;
17
+ }, {}); };
21
18
  }
22
19
  function applyMiddleware(middlewares) {
23
20
  return function (storeCreator) { return function (reducer, intialState) {
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ function createStore(reducer, intialState, storeEnhancer) {
24
24
  }
25
25
  subscribers.push.apply(subscribers, subscribtionRequests);
26
26
  return function () {
27
- subscribers.filter(function (sub) { return subscribtionRequests.every(function (subRequest) { return subRequest !== sub; }); });
27
+ subscribers.splice(subscribers.length - subscribtionRequests.length, subscribtionRequests.length);
28
28
  };
29
29
  },
30
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kashcode/reduxish",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A tiny, fully-typed Redux-inspired state management library with store enhancement/plugin support for functionality such as thunking, logging, etc with full type inference on the enhanced store. Complies with flux architecture and fully compatible with react-redux bindings.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,7 +12,11 @@
12
12
  ],
13
13
  "scripts": {
14
14
  "build": "tsc",
15
- "start": "node dist/index.js"
15
+ "start": "node dist/index.js",
16
+ "test": "jest --coverage",
17
+ "test:watch": "jest --watch",
18
+ "prepublishOnly": "npm run test && npm run build",
19
+ "publish": "npm run prepublishOnly && npm publish"
16
20
  },
17
21
  "author": "Kasope <kasopej@gmail.com>",
18
22
  "license": "MIT",
@@ -33,13 +37,16 @@
33
37
  "middleware"
34
38
  ],
35
39
  "dependencies": {
36
- "deep-freeze": "^0.0.1",
37
- "expect": "^22.4.3"
40
+ "deep-freeze": "^0.0.1"
38
41
  },
39
42
  "devDependencies": {
40
43
  "@types/deep-freeze": "^0.1.5",
44
+ "@types/jest": "30.0.0",
41
45
  "@types/node": "^25.2.0",
42
46
  "ajv": "^8.17.1",
43
- "cross-env": "^10.1.0"
47
+ "cross-env": "^10.1.0",
48
+ "jest": "30.2.0",
49
+ "ts-jest": "29.4.6",
50
+ "ts-node": "10.9.2"
44
51
  }
45
52
  }