File tree 2 files changed +15
-7
lines changed
2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 10
10
"scripts" : {
11
11
"test" : " echo \" Error: no test specified\" && exit 1" ,
12
12
"build" : " rollup -c" ,
13
- "pub-beta" : " npm publish --tag=beta" ,
14
- "pub" : " npm publish"
13
+ "pub-beta" : " npm run build && npm publish --tag=beta" ,
14
+ "pub" : " npm run build && npm publish"
15
15
},
16
16
"author" : " " ,
17
17
"license" : " MIT"
Original file line number Diff line number Diff line change 8
8
9
9
const hasOwn = Object . prototype . hasOwnProperty
10
10
11
- function is ( x , y ) {
12
- if ( x === y ) {
13
- return x !== 0 || y !== 0 || 1 / x === 1 / y
14
- } else {
15
- return x !== x && y !== y
11
+ // 参考:https://github.com/facebook/react/pull/16212
12
+ let is
13
+ if ( typeof Object . is === 'function' ) {
14
+ is = Object . is
15
+ } else {
16
+ is = ( x , y ) => {
17
+ if ( x === y ) {
18
+ return x !== 0 || y !== 0 || 1 / x === 1 / y
19
+ } else {
20
+ return x !== x && y !== y
21
+ }
16
22
}
17
23
}
18
24
25
+
26
+
19
27
export default function shallowEqual ( objA , objB ) {
20
28
if ( is ( objA , objB ) ) return true
21
29
You can’t perform that action at this time.
0 commit comments