Gathering detailed insights and metrics for shallow-equal-props
Gathering detailed insights and metrics for shallow-equal-props
Gathering detailed insights and metrics for shallow-equal-props
Gathering detailed insights and metrics for shallow-equal-props
npm install shallow-equal-props
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
4 Stars
9 Commits
3 Watching
1 Branches
1 Contributors
Updated on 08 Aug 2019
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
-33.3%
110
Compared to previous day
Last week
18.8%
752
Compared to previous week
Last month
12.8%
3,040
Compared to previous month
Last year
14%
32,143
Compared to previous year
1
2
Shallow Equal for React's props.
It is a customize version of shallow-equal-object.
React.Element
React.Element
if props
include React.Element
like children
,Install with npm:
npm install shallow-equal-props
Shallow equal for props.
1import { shallowEqualProps } from "shallow-equal-props"; 2import * as React from "react"; 3class MyComponent extends React.Component { 4 shouldComponentUpdate(nextProps){ 5 return !shallowEqualProps(this.props, nextProps); 6 } 7}
Support React.Element
1// equal to React.Element
2// Check: key and type
3const elementA = React.createElement("div", { key: "a" });
4const elementB = React.createElement("div", { key: "a" });
5assert.equal(shallowEqualProps({
6 child: elementA
7}, {
8 child: elementB
9}), true, "should be equal");
10// Not equal: type
11const elementA = React.createElement("div", { key: "a" });
12const elementB = React.createElement("span", { key: "a" });
13assert.equal(shallowEqualProps({
14 child: elementA
15}, {
16 child: elementB
17}), false, "element is not same type");
18// Not equal: key
19const elementA = React.createElement("div", { key: "a" });
20const elementB = React.createElement("div", { key: "b" });
21assert.equal(shallowEqualProps({
22 child: elementA
23}, {
24 child: elementB
25}), false, "elementA is not equal elementB");
See Releases page.
Install devDependencies and Run npm test
:
npm i -d && npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © azu
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More