New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-custom-compare

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-custom-compare - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

22

CHANGELOG.md

@@ -1,2 +0,2 @@

## [1.0.1](https://github.com/kotarella1110/use-custom-compare/compare/v1.0.0...v1.0.1) (2020-03-13)
## [1.0.2](https://github.com/kotarella1110/use-custom-compare/compare/v1.0.1...v1.0.2) (2020-06-29)

@@ -6,17 +6,21 @@

* **deps:** [security] bump acorn from 6.4.0 to 6.4.1 ([204a694](https://github.com/kotarella1110/use-custom-compare/commit/204a69469859d16e7c207597041bc06cae89fb21))
* **memoize:** fix depsAreEqual argument order ([#191](https://github.com/kotarella1110/use-custom-compare/issues/191)) ([ca386c6](https://github.com/kotarella1110/use-custom-compare/commit/ca386c6213e791d33460e45a9b90e581cc2e866d)), closes [#186](https://github.com/kotarella1110/use-custom-compare/issues/186)
## [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)
### Bug Fixes
* changed to throw error from output console ([#4](https://github.com/kotarella1110/use-custom-compare/issues/4)) ([871c7af](https://github.com/kotarella1110/use-custom-compare/commit/871c7af0fff578cb5f15af1cf974e821d06d5fa3))
- changed to throw error from output console ([#4](https://github.com/kotarella1110/use-custom-compare/issues/4)) ([871c7af](https://github.com/kotarella1110/use-custom-compare/commit/871c7af0fff578cb5f15af1cf974e821d06d5fa3))
### Features
* **callback:** add useCustomCompareCallback ([#2](https://github.com/kotarella1110/use-custom-compare/issues/2)) ([a4e47ed](https://github.com/kotarella1110/use-custom-compare/commit/a4e47edc5f5b5bf9c7c3ba1be681c84c88b4189d))
* **effect:** add useCustomCompareEffect ([#1](https://github.com/kotarella1110/use-custom-compare/issues/1)) ([d1d70c8](https://github.com/kotarella1110/use-custom-compare/commit/d1d70c8eaf0394509e577174bd2bef15bf6721d5))
* **memo:** add useCustomCompareMemo ([#3](https://github.com/kotarella1110/use-custom-compare/issues/3)) ([34874fb](https://github.com/kotarella1110/use-custom-compare/commit/34874fb1b59584526891c7ec440b016ff2dcc671))
* initial ([369670b](https://github.com/kotarella1110/use-custom-compare/commit/369670bd57db1abdf663b3ae7ef942f5b914ee92))
- **callback:** add useCustomCompareCallback ([#2](https://github.com/kotarella1110/use-custom-compare/issues/2)) ([a4e47ed](https://github.com/kotarella1110/use-custom-compare/commit/a4e47edc5f5b5bf9c7c3ba1be681c84c88b4189d))
- **effect:** add useCustomCompareEffect ([#1](https://github.com/kotarella1110/use-custom-compare/issues/1)) ([d1d70c8](https://github.com/kotarella1110/use-custom-compare/commit/d1d70c8eaf0394509e577174bd2bef15bf6721d5))
- **memo:** add useCustomCompareMemo ([#3](https://github.com/kotarella1110/use-custom-compare/issues/3)) ([34874fb](https://github.com/kotarella1110/use-custom-compare/commit/34874fb1b59584526891c7ec440b016ff2dcc671))
- initial ([369670b](https://github.com/kotarella1110/use-custom-compare/commit/369670bd57db1abdf663b3ae7ef942f5b914ee92))

@@ -20,3 +20,3 @@ import { useRef, useEffect, useCallback, useMemo } from 'react';

var ref = useRef([]);
if (!ref.current || !depsAreEqual(deps, ref.current)) {
if (!ref.current || !depsAreEqual(ref.current, deps)) {
ref.current = deps;

@@ -23,0 +23,0 @@ }

@@ -24,3 +24,3 @@ 'use strict';

var ref = react.useRef([]);
if (!ref.current || !depsAreEqual(deps, ref.current)) {
if (!ref.current || !depsAreEqual(ref.current, deps)) {
ref.current = deps;

@@ -27,0 +27,0 @@ }

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).useCustomCompare={},e.React)}(this,(function(e,t){"use strict";function o(e){return null==e||/^[sbn]/.test(typeof e)}function r(e,t,r){var n="React."+r.replace(/CustomCompare/,"");if(!(e instanceof Array)||0===e.length)throw new Error(r+" should not be used with no dependencies. Use "+n+" instead.");if(e.every(o))throw new Error(r+" should not be used with dependencies that are all primitive values. Use "+n+" instead.");if("function"!=typeof t)throw new Error(r+" should be used with depsEqual callback for comparing deps list")}function n(e,o){var r=t.useRef([]);return r.current&&o(e,r.current)||(r.current=e),r.current}e.useCustomCompareCallback=function(e,o,u){return"production"!==process.env.NODE_ENV&&r(o,u,"useCustomCompareCallback"),t.useCallback(e,n(o,u))},e.useCustomCompareEffect=function(e,o,u){"production"!==process.env.NODE_ENV&&r(o,u,"useCustomCompareEffect"),t.useEffect(e,n(o,u))},e.useCustomCompareMemo=function(e,o,u){return"production"!==process.env.NODE_ENV&&r(o,u,"useCustomCompareMemo"),t.useMemo(e,n(o,u))},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).useCustomCompare={},e.React)}(this,(function(e,t){"use strict";function o(e){return null==e||/^[sbn]/.test(typeof e)}function r(e,t,r){var n="React."+r.replace(/CustomCompare/,"");if(!(e instanceof Array)||0===e.length)throw new Error(r+" should not be used with no dependencies. Use "+n+" instead.");if(e.every(o))throw new Error(r+" should not be used with dependencies that are all primitive values. Use "+n+" instead.");if("function"!=typeof t)throw new Error(r+" should be used with depsEqual callback for comparing deps list")}function n(e,o){var r=t.useRef([]);return r.current&&o(r.current,e)||(r.current=e),r.current}e.useCustomCompareCallback=function(e,o,u){return"production"!==process.env.NODE_ENV&&r(o,u,"useCustomCompareCallback"),t.useCallback(e,n(o,u))},e.useCustomCompareEffect=function(e,o,u){"production"!==process.env.NODE_ENV&&r(o,u,"useCustomCompareEffect"),t.useEffect(e,n(o,u))},e.useCustomCompareMemo=function(e,o,u){return"production"!==process.env.NODE_ENV&&r(o,u,"useCustomCompareMemo"),t.useMemo(e,n(o,u))},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=use-custom-compare.umd.min.js.map
{
"name": "use-custom-compare",
"version": "1.0.1",
"version": "1.0.2",
"description": "It's React's useEffect/useMemo/useCallback hooks, except using custom comparison on the inputs, not reference equality",

@@ -41,38 +41,38 @@ "main": "dist/use-custom-compare.js",

"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@semantic-release/changelog": "^5.0.0",
"@commitlint/cli": "^9.0.1",
"@commitlint/config-conventional": "^9.0.1",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@testing-library/react-hooks": "^3.2.1",
"@types/jest": "^25.1.4",
"@types/react": "^16.9.23",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.1.0",
"@testing-library/react-hooks": "^3.3.0",
"@types/jest": "^26.0.3",
"@types/react": "^16.9.41",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"commitizen": "^4.1.2",
"cz-conventional-changelog": "^3.2.0",
"dequal": "^1.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-typescript": "^7.0.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"git-cz": "^4.3.1",
"husky": "^4.2.3",
"jest": "^25.1.0",
"lint-staged": "^10.0.8",
"prettier": "^1.19.1",
"react": "^16.13.0",
"react-test-renderer": "^16.13.0",
"eslint-config-airbnb-typescript": "^7.2.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.1",
"eslint-plugin-react-hooks": "^4.0.4",
"git-cz": "^4.7.0",
"husky": "^4.2.5",
"jest": "^25.5.4",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"react": "^16.13.1",
"react-test-renderer": "^16.13.1",
"rimraf": "^3.0.2",
"rollup": "^1.32.1",
"rollup-plugin-filesize": "^6.2.1",
"rollup": "^2.18.1",
"rollup-plugin-filesize": "^9.0.1",
"rollup-plugin-peer-deps-external": "^2.2.2",
"rollup-plugin-sourcemaps": "^0.5.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.26.0",
"semantic-release": "^17.0.4",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
"rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-terser": "^6.1.0",
"rollup-plugin-typescript2": "^0.27.1",
"semantic-release": "^17.1.1",
"ts-jest": "^25.5.1",
"typescript": "^3.9.5"
},

@@ -91,2 +91,6 @@ "peerDependencies": {

"npm run lint:fix"
],
"*.{md,json}": [
"prettier --write",
"git add"
]

@@ -93,0 +97,0 @@ },

@@ -1,43 +0,33 @@

<h1 align="center">use-custom-compare</h1>
<div align="center">
<p align="center">It's React's useEffect/useMemo/useCallback hooks, except using custom comparison on the inputs, not reference equality</p>
<h1>use-custom-compare</h1>
<p align="center">
<a href="LICENSE">
<img alt="License" src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square">
</a>
<a href="https://github.com/kotarella1110/use-custom-compare/actions?query=workflow%3ACI">
<img alt="Actions Status" src="https://github.com/kotarella1110/use-custom-compare/workflows/CI/badge.svg">
</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">
<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">
</a>
<a href="http://commitizen.github.io/cz-cli/">
<img alt="Commitizen friendly" src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square">
</a>
<a href="#contributors-">
<img alt="All Contributors" src="https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square">
</a>
<a href="CONTRIBUTING.md">
<img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-welcome-green.svg?style=flat-square">
</a>
</p>
It's React's useEffect/useMemo/useCallback hooks, except using custom comparison on the inputs, not reference equality
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
[![Actions Status](https://github.com/kotarella1110/use-custom-compare/workflows/CI/badge.svg)](https://github.com/kotarella1110/use-custom-compare/actions?query=workflow%3ACI)
[![NPM Version](https://img.shields.io/npm/v/use-custom-compare?style=flat-square)](https://www.npmjs.com/package/use-custom-compare)
[![Downloads Month](https://img.shields.io/npm/dm/use-custom-compare?style=flat-square)](https://www.npmjs.com/package/use-custom-compare)
[![Downloads Total](https://img.shields.io/npm/dt/use-custom-compare?style=flat-square)](https://www.npmjs.com/package/use-custom-compare)
[![Dependencies Status](https://david-dm.org/kotarella1110/use-custom-compare.svg?style=flat-square)](https://david-dm.org/kotarella1110/use-custom-compare)
[![Semantic Release](https://img.shields.io/badge/%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
[![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg?style=flat-square)](CONTRIBUTING.md)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
</div>
## Installation
```
npm install react-use-custom-compare
npm install use-custom-compare
# or
yarn add react-use-custom-compare
yarn add use-custom-compare
```

@@ -50,5 +40,5 @@

```js
import React from 'react';
import { useCustomCompareEffect } from 'use-custom-compare';
import isEqual from 'lodash/isEqual';
import React from "react";
import { useCustomCompareEffect } from "use-custom-compare";
import isEqual from "lodash/isEqual";

@@ -64,3 +54,3 @@ function App({ options }) {

[options],
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps),
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps)
);

@@ -75,5 +65,5 @@

```js
import React from 'react';
import { useCustomCompareCallback } from 'use-custom-compare';
import isEqual from 'lodash/isEqual';
import React from "react";
import { useCustomCompareCallback } from "use-custom-compare";
import isEqual from "lodash/isEqual";

@@ -86,3 +76,3 @@ function App({ options }) {

[options],
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps),
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps)
);

@@ -97,5 +87,5 @@

```js
import React from 'react';
import { useCustomCompareMemo } from 'use-custom-compare';
import isEqual from 'lodash/isEqual';
import React from "react";
import { useCustomCompareMemo } from "use-custom-compare";
import isEqual from "lodash/isEqual";

@@ -108,3 +98,3 @@ function App({ options }) {

[options],
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps),
(prevDeps, nextDeps) => isEqual(prevDeps, nextDeps)
);

@@ -141,2 +131,3 @@

<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

@@ -148,2 +139,2 @@

[MIT](./LICENSE) © [Kotaro Sugawara](https://twitter.com/kotarella1110)
[MIT](./LICENSE) © [Kotaro Sugawara](https://twitter.com/kotarella1110)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc