use-deep-compare
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -10,7 +10,4 @@ 'use strict'; | ||
function isPrimitive(val) { | ||
return val == null || /^[sbn]/.test(typeof val); | ||
} | ||
function checkDeps(deps, name) { | ||
const reactHookName = `React.${name.replace(/DeepCompare/, '')}`; | ||
const reactHookName = `React.${name.replace(/DeepCompare/, "")}`; | ||
@@ -20,6 +17,2 @@ if (!deps || deps.length === 0) { | ||
} | ||
if (deps.every(isPrimitive)) { | ||
throw new Error(`${name} should not be used with dependencies that are all primitive values. Use ${reactHookName} instead.`); | ||
} | ||
} | ||
@@ -26,0 +19,0 @@ function useDeepCompareMemoize(value) { |
@@ -1,8 +0,5 @@ | ||
import deepEqual from 'dequal'; | ||
import React from 'react'; | ||
export function isPrimitive(val) { | ||
return val == null || /^[sbn]/.test(typeof val); | ||
} | ||
import React from "react"; | ||
import deepEqual from "dequal"; | ||
export function checkDeps(deps, name) { | ||
const reactHookName = `React.${name.replace(/DeepCompare/, '')}`; | ||
const reactHookName = `React.${name.replace(/DeepCompare/, "")}`; | ||
@@ -12,6 +9,2 @@ if (!deps || deps.length === 0) { | ||
} | ||
if (deps.every(isPrimitive)) { | ||
throw new Error(`${name} should not be used with dependencies that are all primitive values. Use ${reactHookName} instead.`); | ||
} | ||
} | ||
@@ -18,0 +11,0 @@ export function useDeepCompareMemoize(value) { |
@@ -1,4 +0,3 @@ | ||
import React from 'react'; | ||
export declare function isPrimitive(val: any): boolean; | ||
import React from "react"; | ||
export declare function checkDeps(deps: React.DependencyList, name: string): void; | ||
export declare function useDeepCompareMemoize(value: React.DependencyList): React.DependencyList; |
import React from 'react'; | ||
import deepEqual from 'dequal'; | ||
function isPrimitive(val) { | ||
return val == null || /^[sbn]/.test(typeof val); | ||
} | ||
function checkDeps(deps, name) { | ||
const reactHookName = `React.${name.replace(/DeepCompare/, '')}`; | ||
const reactHookName = `React.${name.replace(/DeepCompare/, "")}`; | ||
@@ -13,6 +10,2 @@ if (!deps || deps.length === 0) { | ||
} | ||
if (deps.every(isPrimitive)) { | ||
throw new Error(`${name} should not be used with dependencies that are all primitive values. Use ${reactHookName} instead.`); | ||
} | ||
} | ||
@@ -19,0 +12,0 @@ function useDeepCompareMemoize(value) { |
{ | ||
"name": "use-deep-compare", | ||
"description": "React hooks, except using deep comparison on the inputs, not reference equality", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21674
242