tree-changes-hook
Advanced tools
Comparing version 0.0.1 to 0.7.0
{ | ||
"name": "tree-changes-hook", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "index.js", | ||
"version": "0.7.0", | ||
"description": "React hook for tree-changes", | ||
"author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"keywords": [ | ||
"comparison", | ||
"tree", | ||
"react", | ||
"hook" | ||
], | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gilbarbara/tree-changes.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/gilbarbara/tree-changes/issues" | ||
}, | ||
"homepage": "https://github.com/gilbarbara/tree-changes/tree/master/packages/tree-changes-hook#readme", | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"files": [ | ||
"esm", | ||
"lib", | ||
"src" | ||
], | ||
"types": "lib", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0" | ||
}, | ||
"dependencies": { | ||
"@testing-library/jest-dom": "^5.11.9", | ||
"@testing-library/react": "^11.2.5", | ||
"@types/react": "^17.0.2", | ||
"@types/react-dom": "^17.0.1", | ||
"fast-deep-equal": "^3.1.3", | ||
"react": "^16.8.0 || ^17.0.0", | ||
"react-dom": "^17.0.1", | ||
"tree-changes": "^0.7.0" | ||
}, | ||
"devDependencies": { | ||
"del-cli": "^3.0.1", | ||
"typescript": "^4.1.5" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"build": "npm run clean && npm run build:cjs && npm run build:esm", | ||
"build:cjs": "tsc", | ||
"build:esm": "tsc -m es6 --outDir esm", | ||
"watch:cjs": "npm run build:cjs -- -w", | ||
"watch:esm": "npm run build:esm -- -w", | ||
"lint": "eslint --ext .ts,.tsx src test", | ||
"clean": "del lib/* && del esm/*", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage --bail", | ||
"test:watch": "jest --watchAll --verbose", | ||
"format": "prettier \"**/*.{js,jsx,json,yml,yaml,css,less,scss,ts,tsx,md,graphql,mdx}\" --write", | ||
"validate": "npm run lint && npm run test:coverage && npm run build && npm run size", | ||
"size": "size-limit", | ||
"prepublishOnly": "npm run validate" | ||
}, | ||
"keywords": [], | ||
"author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"license": "MIT" | ||
"prettier": { | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"arrowParens": "avoid", | ||
"printWidth": 100, | ||
"proseWrap": "never" | ||
}, | ||
"size-limit": [ | ||
{ | ||
"path": "./lib/index.js", | ||
"limit": "3 kB" | ||
}, | ||
{ | ||
"path": "./esm/index.js", | ||
"limit": "3 kB" | ||
} | ||
], | ||
"gitHead": "1d185e339da99e3761b43aaa60e99a9a6bc6aba2" | ||
} |
# tree-changes-hook | ||
React hook for [tree-changes](https://github.com/gilbarbara/tree-changes). | ||
[![NPM version](https://badge.fury.io/js/tree-changes-hook.svg)](https://www.npmjs.com/package/tree-changes-hook) [![build status](https://travis-ci.org/gilbarbara/tree-changes.svg)](https://travis-ci.org/gilbarbara/tree-changes) [![Maintainability](https://api.codeclimate.com/v1/badges/93528e49029782f5f7d2/maintainability)](https://codeclimate.com/github/gilbarbara/tree-changes/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/93528e49029782f5f7d2/test_coverage)](https://codeclimate.com/github/gilbarbara/tree-changes/test_coverage) | ||
React hook that uses [tree-changes](https://github.com/gilbarbara/tree-changes/tree/master/packages/tree-changes) to compare changes between two datasets. | ||
## Setup | ||
```bash | ||
npm install tree-changes-hook | ||
``` | ||
## Usage | ||
```typescript | ||
import React from 'react'; | ||
import useTreeChanges from 'tree-changes-hook'; | ||
function App(props) { | ||
const { changed } = useTreeChanges(props); | ||
React.useEffect(() => { | ||
if (changed('hasData', true)) { | ||
sendAnalyticsEvent('load', 'MySuperPage'); | ||
} | ||
}); | ||
return <div>...</div>; | ||
} | ||
``` | ||
> It's safe to run all the methods with a `useEffect` without dependencies but it works with them too. | ||
## API | ||
Please refer to [tree-changes](https://github.com/gilbarbara/tree-changes/tree/master/packages/tree-changes) README for detailed usage. | ||
## License | ||
MIT |
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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
9718
10
81
0
1
41
0
0
9
2
+ Added@types/react@^17.0.2
+ Added@types/react-dom@^17.0.1
+ Addedfast-deep-equal@^3.1.3
+ Addedreact@^16.8.0 || ^17.0.0
+ Addedreact-dom@^17.0.1
+ Addedtree-changes@^0.7.0
+ Added@adobe/css-tools@4.4.1(transitive)
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/runtime@7.26.0(transitive)
+ Added@babel/runtime-corejs3@7.26.0(transitive)
+ Added@jest/expect-utils@29.7.0(transitive)
+ Added@jest/schemas@29.6.3(transitive)
+ Added@jest/types@26.6.229.6.3(transitive)
+ Added@sinclair/typebox@0.27.8(transitive)
+ Added@testing-library/dom@7.31.2(transitive)
+ Added@testing-library/jest-dom@5.17.0(transitive)
+ Added@testing-library/react@11.2.7(transitive)
+ Added@types/aria-query@4.2.2(transitive)
+ Added@types/istanbul-lib-coverage@2.0.6(transitive)
+ Added@types/istanbul-lib-report@3.0.3(transitive)
+ Added@types/istanbul-reports@3.0.4(transitive)
+ Added@types/jest@29.5.14(transitive)
+ Added@types/node@22.10.1(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Added@types/react@17.0.83(transitive)
+ Added@types/react-dom@17.0.25(transitive)
+ Added@types/scheduler@0.16.8(transitive)
+ Added@types/stack-utils@2.0.3(transitive)
+ Added@types/testing-library__jest-dom@5.14.9(transitive)
+ Added@types/yargs@15.0.1917.0.33(transitive)
+ Added@types/yargs-parser@21.0.3(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.05.2.0(transitive)
+ Addedaria-query@4.2.25.3.2(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedchalk@3.0.04.1.2(transitive)
+ Addedci-info@3.9.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcore-js-pure@3.39.0(transitive)
+ Addedcss.escape@1.5.1(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addeddiff-sequences@29.6.3(transitive)
+ Addeddom-accessibility-api@0.5.16(transitive)
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedexpect@29.7.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedindent-string@4.0.0(transitive)
+ Addedis-lite@0.8.2(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedjest-diff@29.7.0(transitive)
+ Addedjest-get-type@29.6.3(transitive)
+ Addedjest-matcher-utils@29.7.0(transitive)
+ Addedjest-message-util@29.7.0(transitive)
+ Addedjest-util@29.7.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedlz-string@1.5.0(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedmin-indent@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpretty-format@26.6.229.7.0(transitive)
+ Addedreact@17.0.2(transitive)
+ Addedreact-dom@17.0.2(transitive)
+ Addedreact-is@17.0.218.3.1(transitive)
+ Addedredent@3.0.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedscheduler@0.20.2(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedstack-utils@2.0.6(transitive)
+ Addedstrip-indent@3.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtree-changes@0.7.1(transitive)
+ Addedundici-types@6.20.0(transitive)