use-custom-compare
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,8 @@ | ||
## [1.0.1](https://github.com/kotarella1110/use-custom-compare/compare/v1.0.0...v1.0.1) (2020-03-13) | ||
### Bug Fixes | ||
* **deps:** [security] bump acorn from 6.4.0 to 6.4.1 ([204a694](https://github.com/kotarella1110/use-custom-compare/commit/204a69469859d16e7c207597041bc06cae89fb21)) | ||
# 1.0.0 (2020-03-04) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "use-custom-compare", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "It's React's useEffect/useMemo/useCallback hooks, except using custom comparison on the inputs, not reference equality", | ||
"main": "lib/index.js", | ||
"module": "lib/index.esm.js", | ||
"main": "dist/use-custom-compare.js", | ||
"module": "dist/use-custom-compare.esm.js", | ||
"unpkg": "dist/use-custom-compare.umd.min.js", | ||
"types": "dist/index.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"lib" | ||
"dist" | ||
], | ||
"types": "lib/index.d.ts", | ||
"typings": "lib/index.d.ts", | ||
"scripts": { | ||
"build": "npm run clean && rollup -c", | ||
"clean": "rimraf lib", | ||
"clean": "rimraf dist", | ||
"lint": "eslint '**/*.{js,ts}'", | ||
@@ -46,5 +46,5 @@ "lint:fix": "npm run lint -- --fix", | ||
"@testing-library/react-hooks": "^3.2.1", | ||
"@types/jest": "^25.1.3", | ||
"@types/jest": "^25.1.4", | ||
"@types/react": "^16.9.23", | ||
"@typescript-eslint/eslint-plugin": "^2.22.0", | ||
"@typescript-eslint/eslint-plugin": "^2.23.0", | ||
"commitizen": "^4.0.3", | ||
@@ -59,4 +59,4 @@ "cz-conventional-changelog": "^3.1.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.18.3", | ||
"eslint-plugin-react-hooks": "^1.7.0", | ||
"eslint-plugin-react": "^7.19.0", | ||
"eslint-plugin-react-hooks": "^2.5.0", | ||
"git-cz": "^4.3.1", | ||
@@ -70,6 +70,7 @@ "husky": "^4.2.3", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^1.32.0", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-filesize": "^6.2.1", | ||
"rollup-plugin-peer-deps-external": "^2.2.2", | ||
"rollup-plugin-terser": "^5.2.0", | ||
"rollup-plugin-sourcemaps": "^0.5.0", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"rollup-plugin-typescript2": "^0.26.0", | ||
@@ -76,0 +77,0 @@ "semantic-release": "^17.0.4", |
@@ -12,2 +12,11 @@ <h1 align="center">use-custom-compare</h1> | ||
</a> | ||
<a href="https://www.npmjs.com/package/use-custom-compare"> | ||
<img alt="Downloads Month" src="https://img.shields.io/npm/dm/use-custom-compare?style=flat-square"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/use-custom-compare"> | ||
<img alt="Downloads Total" src="https://img.shields.io/npm/dt/use-custom-compare?style=flat-square"> | ||
</a> | ||
<a href="https://david-dm.org/kotarella1110/use-custom-compare"> | ||
<img alt="Dependencies Status" src="https://david-dm.org/kotarella1110/use-custom-compare.svg?style=flat-square"> | ||
</a> | ||
<a href="https://github.com/semantic-release/semantic-release"> | ||
@@ -47,8 +56,12 @@ <img alt="Semantic Release" src="https://img.shields.io/badge/%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square"> | ||
function App({ options }) { | ||
useCustomCompareEffect(() => { | ||
// do something significant here | ||
return () => { | ||
// return to clean up that significant thing | ||
}; | ||
}, [options], (prevDeps, nextDeps) => isEqual(prevDeps, nextDeps)); | ||
useCustomCompareEffect( | ||
() => { | ||
// do something significant here | ||
return () => { | ||
// return to clean up that significant thing | ||
}; | ||
}, | ||
[options], | ||
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps), | ||
); | ||
@@ -67,5 +80,9 @@ return <div>{/* render significant thing */}</div>; | ||
function App({ options }) { | ||
const memoized = useCustomCompareCallback(() => { | ||
// do something significant here | ||
}, [options], (prevDeps, nextDeps) => isEqual(prevDeps, nextDeps)); | ||
const memoized = useCustomCompareCallback( | ||
() => { | ||
// do something significant here | ||
}, | ||
[options], | ||
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps), | ||
); | ||
@@ -84,5 +101,9 @@ return <div>{/* render significant thing */}</div>; | ||
function App({ options }) { | ||
const memoized = useCustomCompareMemo(() => { | ||
// do something significant here | ||
}, [options], (prevDeps, nextDeps) => isEqual(prevDeps, nextDeps)); | ||
const memoized = useCustomCompareMemo( | ||
() => { | ||
// do something significant here | ||
}, | ||
[options], | ||
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps), | ||
); | ||
@@ -89,0 +110,0 @@ return <div>{/* render significant thing */}</div>; |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
30647
16
118
141
36
9