Skip to content

Commit

Permalink
Clean up unnecessary code.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Nov 11, 2020
1 parent c53d4fc commit 91328a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/is-shallow-equal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import isShallowEqualArrays from './arrays';
export { default as isShallowEqualObjects } from './objects';
export { default as isShallowEqualArrays } from './arrays';

const isArray = Array.isArray;

/**
* @typedef {Record<string, any>} ComparableObject
*/
Expand All @@ -26,7 +24,7 @@ export default function isShallowEqual( a, b ) {
if ( a && b ) {
if ( a.constructor === Object && b.constructor === Object ) {
return isShallowEqualObjects( a, b );
} else if ( isArray( a ) && isArray( b ) ) {
} else if ( Array.isArray( a ) && Array.isArray( b ) ) {
return isShallowEqualArrays( a, b );
}
}
Expand Down
6 changes: 2 additions & 4 deletions packages/is-shallow-equal/src/objects.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const keys = Object.keys;

/**
* Returns true if the two objects are shallow equal, or false otherwise.
*
Expand All @@ -13,8 +11,8 @@ export default function isShallowEqualObjects( a, b ) {
return true;
}

const aKeys = keys( a );
const bKeys = keys( b );
const aKeys = Object.keys( a );
const bKeys = Object.keys( b );

if ( aKeys.length !== bKeys.length ) {
return false;
Expand Down

0 comments on commit 91328a6

Please sign in to comment.