@lowentry/react-redux 1.0.4 → 1.1.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/LeRed.js +14 -3
  2. package/package.json +1 -1
package/LeRed.js CHANGED
@@ -14,7 +14,7 @@ export const LeRed = (() =>
14
14
 
15
15
  try
16
16
  {
17
- const set = (value, key, ignoreOverrides = false) =>
17
+ const set = (key, value, ignoreOverrides = false) =>
18
18
  {
19
19
  const keyFirstChar = key.charAt(0);
20
20
  if(keyFirstChar === keyFirstChar.toLowerCase() && (keyFirstChar !== keyFirstChar.toUpperCase()))
@@ -43,11 +43,11 @@ export const LeRed = (() =>
43
43
  {
44
44
  LeUtils.each(obj, (value, key) =>
45
45
  {
46
- set(value, key, ignoreOverrides);
46
+ set(key, value, ignoreOverrides);
47
47
  }, optionalSkipHasOwnPropertyCheck);
48
48
  };
49
49
 
50
- LeRed.set = (value, key) => set(value, key, true);
50
+ LeRed.set = (key, value) => set(key, value, true);
51
51
  LeRed.setAll = (obj, optionalSkipHasOwnPropertyCheck = true) => setAll(obj, true, optionalSkipHasOwnPropertyCheck);
52
52
 
53
53
  setAll(ReactDOM);
@@ -826,6 +826,17 @@ export const LeRed = (() =>
826
826
  return React.useMemo(callable, comparingValues);
827
827
  };
828
828
 
829
+ LeRed.useCallback = (callable, comparingValues, equalsComparator) =>
830
+ {
831
+ console.log('LeRed callback');
832
+ equalsComparator = fixEqualsComparator(equalsComparator, 'LeRed.useCallback() was given an invalid comparator:');
833
+ comparingValues = ARRAY(comparingValues);
834
+ // eslint-disable-next-line react-hooks/rules-of-hooks
835
+ comparingValues = comparingValues.map(value => useCompareMemoize(value, equalsComparator));
836
+ // eslint-disable-next-line react-hooks/exhaustive-deps
837
+ return React.useCallback(callable, comparingValues);
838
+ };
839
+
829
840
  LeRed.usePrevious = (value, initialValue) =>
830
841
  {
831
842
  const ref = LeRed.useRef(initialValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowentry/react-redux",
3
- "version": "1.0.4",
3
+ "version": "1.1.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Provides utilities for React and Redux.",