define-zustand 3.2.0 → 3.2.1

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/dist/utils.js +3 -3
  2. package/package.json +1 -1
package/dist/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useRef, useContext, createContext } from 'react';
2
2
  import { create, useStore, createStore } from 'zustand';
3
3
  import { produce } from 'immer';
4
- import { keys, isEqualWith, omit, some, pick, forEach, isEqual } from 'lodash-es';
4
+ import { keys, isEqualWith, omit, some, pick, forOwn, isEqual } from 'lodash-es';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  function defineStateFactory(options) {
@@ -10,7 +10,7 @@ function defineStateFactory(options) {
10
10
  function creator(options) {
11
11
  function createDefState() {
12
12
  const state = options.state();
13
- forEach(options.getter, (getter, k) => {
13
+ forOwn(options.getter, (getter, k) => {
14
14
  state[k] = getter(state);
15
15
  });
16
16
  return state;
@@ -23,7 +23,7 @@ function creator(options) {
23
23
  const isUpdate = isEqualWith(omit(state, getterKeys), omit(prevState, getterKeys), (current, prev) => some(current, (v, k) => v !== prev[k]));
24
24
  if (isUpdate) {
25
25
  const newGetterState = pick(state, getterKeys);
26
- forEach(options.getter, (getter, k) => {
26
+ forOwn(options.getter, (getter, k) => {
27
27
  if (isEqual(newGetterState[k], getter(state))) {
28
28
  return;
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "define-zustand",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",