tiny-slice 0.1.0 → 1.0.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/LICENSE.md +21 -0
- package/README.md +7 -0
- package/dist/dist/index.d.ts +54 -0
- package/dist/dist/index.js +249 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -4
- package/package.json +3 -2
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Alejandro Gonzalez Sole
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -6,6 +6,13 @@ The library internally uses React's `useReducer` which works standalone without
|
|
|
6
6
|
|
|
7
7
|
This is not a replacement for Redux. It's a lightweight alternative for simple state management action/reducer.
|
|
8
8
|
|
|
9
|
+
## Install
|
|
10
|
+
```bash
|
|
11
|
+
npm install tiny-slice
|
|
12
|
+
# or
|
|
13
|
+
yarn add tiny-slice
|
|
14
|
+
```
|
|
15
|
+
|
|
9
16
|
## Features
|
|
10
17
|
|
|
11
18
|
- Lightweight
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type ActionPayload<T> = T;
|
|
2
|
+
type ActionReducer<State, Payload> = (state: State, payload: Payload) => void;
|
|
3
|
+
type ThunkAction<Result = void> = {
|
|
4
|
+
type: string;
|
|
5
|
+
payload: any;
|
|
6
|
+
async: true;
|
|
7
|
+
thunk: (dispatch: ThunkDispatch, getState: () => any) => Promise<Result>;
|
|
8
|
+
};
|
|
9
|
+
type Action = {
|
|
10
|
+
type: string;
|
|
11
|
+
payload: any;
|
|
12
|
+
async?: false;
|
|
13
|
+
};
|
|
14
|
+
type ThunkDispatch = <T = void>(action: Action | ThunkAction<T>) => Promise<T>;
|
|
15
|
+
type AsyncActionHelpers<State> = {
|
|
16
|
+
getState: () => State;
|
|
17
|
+
dispatch: ThunkDispatch;
|
|
18
|
+
};
|
|
19
|
+
type AsyncActionReducer<State, Payload, Result> = {
|
|
20
|
+
action: (payload: Payload, helpers: AsyncActionHelpers<State>) => Promise<Result>;
|
|
21
|
+
onSuccess?: (state: State, payload: Result) => void;
|
|
22
|
+
onPending?: (state: State) => void;
|
|
23
|
+
onError?: (state: State, payload: {
|
|
24
|
+
error: Error;
|
|
25
|
+
}) => void;
|
|
26
|
+
};
|
|
27
|
+
type ActionReducers<State> = Record<string, ActionReducer<State, any> | AsyncActionReducer<State, any, any>>;
|
|
28
|
+
interface SliceOptions<State, AR extends ActionReducers<State>> {
|
|
29
|
+
initialState: State;
|
|
30
|
+
actions: AR;
|
|
31
|
+
debug?: boolean;
|
|
32
|
+
}
|
|
33
|
+
type ActionCreator<T> = T extends ActionReducer<any, infer P> ? (payload?: P) => Action : T extends AsyncActionReducer<any, infer P, infer R> ? (payload?: P) => ThunkAction<R> : never;
|
|
34
|
+
type SliceActions<AR extends ActionReducers<any>> = {
|
|
35
|
+
[K in keyof AR]: ActionCreator<AR[K]>;
|
|
36
|
+
};
|
|
37
|
+
export declare function createAsyncAction<Payload, Result, State>(action: (payload: Payload, helpers: AsyncActionHelpers<State>) => Promise<Result>, handlers: {
|
|
38
|
+
onSuccess?: (state: State, payload: Result) => void;
|
|
39
|
+
onPending?: (state: State) => void;
|
|
40
|
+
onError?: (state: State, payload: {
|
|
41
|
+
error: Error;
|
|
42
|
+
}) => void;
|
|
43
|
+
}): AsyncActionReducer<State, Payload, Result>;
|
|
44
|
+
export declare function createTinySlice<State, AR extends ActionReducers<State>>(options: SliceOptions<State, AR>): {
|
|
45
|
+
readonly initialState: State;
|
|
46
|
+
readonly reducer: (state: State, action: {
|
|
47
|
+
type: string;
|
|
48
|
+
payload: any;
|
|
49
|
+
}) => State;
|
|
50
|
+
readonly reducers: AR;
|
|
51
|
+
readonly actions: SliceActions<AR>;
|
|
52
|
+
};
|
|
53
|
+
export declare function useTinySlice<State, AR extends ActionReducers<State>>(slice: ReturnType<typeof createTinySlice<State, AR>>): readonly [State, SliceActions<AR>];
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.createAsyncAction = createAsyncAction;
|
|
51
|
+
exports.createTinySlice = createTinySlice;
|
|
52
|
+
exports.useTinySlice = useTinySlice;
|
|
53
|
+
var react_1 = require("react");
|
|
54
|
+
// Helper function to create async actions
|
|
55
|
+
function createAsyncAction(action, handlers) {
|
|
56
|
+
return __assign({ action: action }, handlers);
|
|
57
|
+
}
|
|
58
|
+
function deepClone(obj, seen) {
|
|
59
|
+
if (seen === void 0) { seen = new WeakMap(); }
|
|
60
|
+
if (obj === null || typeof obj !== 'object') {
|
|
61
|
+
return obj;
|
|
62
|
+
}
|
|
63
|
+
if (seen.has(obj)) {
|
|
64
|
+
return seen.get(obj);
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(obj)) {
|
|
67
|
+
var clonedArray = obj.map(function (item) { return deepClone(item, seen); });
|
|
68
|
+
seen.set(obj, clonedArray);
|
|
69
|
+
return clonedArray;
|
|
70
|
+
}
|
|
71
|
+
var clonedObj = {};
|
|
72
|
+
seen.set(obj, clonedObj);
|
|
73
|
+
for (var key in obj) {
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
75
|
+
clonedObj[key] = deepClone(obj[key], seen);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return clonedObj;
|
|
79
|
+
}
|
|
80
|
+
// Create a tiny slice
|
|
81
|
+
function createTinySlice(options) {
|
|
82
|
+
var _this = this;
|
|
83
|
+
function reducer(state, action) {
|
|
84
|
+
var _a = action.type.split('/'), actionType = _a[0], status = _a[1];
|
|
85
|
+
var actionReducer = options.actions[actionType];
|
|
86
|
+
if (options.debug) {
|
|
87
|
+
console.group("Action: ".concat(action.type));
|
|
88
|
+
console.log('Payload:', JSON.stringify(action.payload, null, 2));
|
|
89
|
+
console.log('Previous State:', JSON.stringify(state, null, 2));
|
|
90
|
+
}
|
|
91
|
+
var newState = state;
|
|
92
|
+
if (actionReducer && 'action' in actionReducer) {
|
|
93
|
+
// Handle async action states
|
|
94
|
+
switch (status) {
|
|
95
|
+
case 'pending':
|
|
96
|
+
if (actionReducer.onPending) {
|
|
97
|
+
newState = deepClone(state);
|
|
98
|
+
actionReducer.onPending(newState);
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case 'fulfilled':
|
|
102
|
+
if (actionReducer.onSuccess) {
|
|
103
|
+
newState = deepClone(state);
|
|
104
|
+
actionReducer.onSuccess(newState, action.payload);
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 'rejected':
|
|
108
|
+
if (actionReducer.onError) {
|
|
109
|
+
newState = deepClone(state);
|
|
110
|
+
actionReducer.onError(newState, action.payload);
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (actionReducer) {
|
|
116
|
+
// Handle sync action
|
|
117
|
+
newState = deepClone(state);
|
|
118
|
+
actionReducer(newState, action.payload);
|
|
119
|
+
}
|
|
120
|
+
if (options.debug) {
|
|
121
|
+
console.log('Next State:', JSON.stringify(newState, null, 2));
|
|
122
|
+
console.groupEnd();
|
|
123
|
+
}
|
|
124
|
+
return newState;
|
|
125
|
+
}
|
|
126
|
+
// Create action creators that work both in and out of hooks
|
|
127
|
+
var actions = {};
|
|
128
|
+
var _loop_1 = function (actionKey) {
|
|
129
|
+
var actionReducer = options.actions[actionKey];
|
|
130
|
+
if ('action' in actionReducer) {
|
|
131
|
+
actions[actionKey] = (function (payload) { return ({
|
|
132
|
+
type: actionKey,
|
|
133
|
+
payload: payload,
|
|
134
|
+
async: true,
|
|
135
|
+
thunk: function (dispatch, getState) { return __awaiter(_this, void 0, void 0, function () {
|
|
136
|
+
var result, error_1;
|
|
137
|
+
return __generator(this, function (_a) {
|
|
138
|
+
switch (_a.label) {
|
|
139
|
+
case 0:
|
|
140
|
+
_a.trys.push([0, 2, , 3]);
|
|
141
|
+
if (options.debug) {
|
|
142
|
+
console.group("Async Action Started: ".concat(actionKey));
|
|
143
|
+
console.log('Payload:', JSON.stringify(payload, null, 2));
|
|
144
|
+
console.log('Current State:', JSON.stringify(getState(), null, 2));
|
|
145
|
+
}
|
|
146
|
+
if (actionReducer.onPending) {
|
|
147
|
+
dispatch({
|
|
148
|
+
type: "".concat(actionKey, "/pending"),
|
|
149
|
+
payload: null,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return [4 /*yield*/, actionReducer.action(payload, {
|
|
153
|
+
getState: getState,
|
|
154
|
+
dispatch: dispatch,
|
|
155
|
+
})];
|
|
156
|
+
case 1:
|
|
157
|
+
result = _a.sent();
|
|
158
|
+
if (actionReducer.onSuccess) {
|
|
159
|
+
dispatch({
|
|
160
|
+
type: "".concat(actionKey, "/fulfilled"),
|
|
161
|
+
payload: result,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (options.debug) {
|
|
165
|
+
console.log('Action Result:', JSON.stringify(result, null, 2));
|
|
166
|
+
console.groupEnd();
|
|
167
|
+
}
|
|
168
|
+
return [2 /*return*/, result];
|
|
169
|
+
case 2:
|
|
170
|
+
error_1 = _a.sent();
|
|
171
|
+
if (options.debug) {
|
|
172
|
+
console.log('Action Error:', error_1);
|
|
173
|
+
console.groupEnd();
|
|
174
|
+
}
|
|
175
|
+
if (actionReducer.onError) {
|
|
176
|
+
dispatch({
|
|
177
|
+
type: "".concat(actionKey, "/rejected"),
|
|
178
|
+
payload: { error: error_1 },
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
throw error_1;
|
|
182
|
+
case 3: return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}); },
|
|
186
|
+
}); });
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
actions[actionKey] = (function (payload) { return ({
|
|
190
|
+
type: actionKey,
|
|
191
|
+
payload: payload,
|
|
192
|
+
async: false,
|
|
193
|
+
}); });
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
for (var _i = 0, _a = Object.keys(options.actions); _i < _a.length; _i++) {
|
|
197
|
+
var actionKey = _a[_i];
|
|
198
|
+
_loop_1(actionKey);
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
initialState: options.initialState,
|
|
202
|
+
reducer: reducer,
|
|
203
|
+
reducers: options.actions,
|
|
204
|
+
actions: actions,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
// Hook to use the tiny slice
|
|
208
|
+
function useTinySlice(slice) {
|
|
209
|
+
var _this = this;
|
|
210
|
+
var _a = (0, react_1.useReducer)(slice.reducer, slice.initialState), state = _a[0], dispatch = _a[1];
|
|
211
|
+
var stateRef = (0, react_1.useRef)(state);
|
|
212
|
+
stateRef.current = state;
|
|
213
|
+
var actionsRef = (0, react_1.useCallback)(function () {
|
|
214
|
+
var actions = {};
|
|
215
|
+
var getState = function () { return stateRef.current; };
|
|
216
|
+
var enhancedDispatch = function (action) { return __awaiter(_this, void 0, void 0, function () {
|
|
217
|
+
return __generator(this, function (_a) {
|
|
218
|
+
if (action.async === true && 'thunk' in action) {
|
|
219
|
+
return [2 /*return*/, action.thunk(enhancedDispatch, getState)];
|
|
220
|
+
}
|
|
221
|
+
dispatch(action);
|
|
222
|
+
return [2 /*return*/, Promise.resolve()];
|
|
223
|
+
});
|
|
224
|
+
}); };
|
|
225
|
+
var _loop_2 = function (actionKey) {
|
|
226
|
+
var actionReducer = slice.reducers[actionKey];
|
|
227
|
+
if ('action' in actionReducer) {
|
|
228
|
+
// Handle async action
|
|
229
|
+
actions[actionKey] = (function (payload) { return __awaiter(_this, void 0, void 0, function () {
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
return [2 /*return*/, enhancedDispatch(slice.actions[actionKey](payload))];
|
|
232
|
+
});
|
|
233
|
+
}); });
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// Handle sync action
|
|
237
|
+
actions[actionKey] = (function (payload) {
|
|
238
|
+
return enhancedDispatch(slice.actions[actionKey](payload));
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
for (var _i = 0, _a = Object.keys(slice.reducers); _i < _a.length; _i++) {
|
|
243
|
+
var actionKey = _a[_i];
|
|
244
|
+
_loop_2(actionKey);
|
|
245
|
+
}
|
|
246
|
+
return actions;
|
|
247
|
+
}, [slice]);
|
|
248
|
+
return [state, actionsRef()];
|
|
249
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare function createAsyncAction<Payload, Result, State>(action: (paylo
|
|
|
41
41
|
error: Error;
|
|
42
42
|
}) => void;
|
|
43
43
|
}): AsyncActionReducer<State, Payload, Result>;
|
|
44
|
-
export declare function createTinySlice<State, AR extends ActionReducers<State>>(options: SliceOptions<State, AR>): {
|
|
44
|
+
export declare function createTinySlice<State = any, AR extends ActionReducers<State> = ActionReducers<State>>(options: SliceOptions<State, AR>): {
|
|
45
45
|
readonly initialState: State;
|
|
46
46
|
readonly reducer: (state: State, action: {
|
|
47
47
|
type: string;
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,28 @@ var react_1 = require("react");
|
|
|
55
55
|
function createAsyncAction(action, handlers) {
|
|
56
56
|
return __assign({ action: action }, handlers);
|
|
57
57
|
}
|
|
58
|
+
function deepClone(obj, seen) {
|
|
59
|
+
if (seen === void 0) { seen = new WeakMap(); }
|
|
60
|
+
if (obj === null || typeof obj !== 'object') {
|
|
61
|
+
return obj;
|
|
62
|
+
}
|
|
63
|
+
if (seen.has(obj)) {
|
|
64
|
+
return seen.get(obj);
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(obj)) {
|
|
67
|
+
var clonedArray = obj.map(function (item) { return deepClone(item, seen); });
|
|
68
|
+
seen.set(obj, clonedArray);
|
|
69
|
+
return clonedArray;
|
|
70
|
+
}
|
|
71
|
+
var clonedObj = {};
|
|
72
|
+
seen.set(obj, clonedObj);
|
|
73
|
+
for (var key in obj) {
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
75
|
+
clonedObj[key] = deepClone(obj[key], seen);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return clonedObj;
|
|
79
|
+
}
|
|
58
80
|
// Create a tiny slice
|
|
59
81
|
function createTinySlice(options) {
|
|
60
82
|
var _this = this;
|
|
@@ -72,19 +94,19 @@ function createTinySlice(options) {
|
|
|
72
94
|
switch (status) {
|
|
73
95
|
case 'pending':
|
|
74
96
|
if (actionReducer.onPending) {
|
|
75
|
-
newState =
|
|
97
|
+
newState = deepClone(state);
|
|
76
98
|
actionReducer.onPending(newState);
|
|
77
99
|
}
|
|
78
100
|
break;
|
|
79
101
|
case 'fulfilled':
|
|
80
102
|
if (actionReducer.onSuccess) {
|
|
81
|
-
newState =
|
|
103
|
+
newState = deepClone(state);
|
|
82
104
|
actionReducer.onSuccess(newState, action.payload);
|
|
83
105
|
}
|
|
84
106
|
break;
|
|
85
107
|
case 'rejected':
|
|
86
108
|
if (actionReducer.onError) {
|
|
87
|
-
newState =
|
|
109
|
+
newState = deepClone(state);
|
|
88
110
|
actionReducer.onError(newState, action.payload);
|
|
89
111
|
}
|
|
90
112
|
break;
|
|
@@ -92,7 +114,7 @@ function createTinySlice(options) {
|
|
|
92
114
|
}
|
|
93
115
|
else if (actionReducer) {
|
|
94
116
|
// Handle sync action
|
|
95
|
-
newState =
|
|
117
|
+
newState = deepClone(state);
|
|
96
118
|
actionReducer(newState, action.payload);
|
|
97
119
|
}
|
|
98
120
|
if (options.debug) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-slice",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A lightweight state management library for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,5 +45,6 @@
|
|
|
45
45
|
"ts-jest": "^29.2.5",
|
|
46
46
|
"typescript": "^5.0.0"
|
|
47
47
|
},
|
|
48
|
-
"license": "MIT"
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"packageManager": "yarn@4.7.0+sha512.5a0afa1d4c1d844b3447ee3319633797bcd6385d9a44be07993ae52ff4facabccafb4af5dcd1c2f9a94ac113e5e9ff56f6130431905884414229e284e37bb7c9"
|
|
49
50
|
}
|