Skip to content

Commit 84c652e

Browse files
committed
Move value checks to save CPU cycles
1 parent 7d45684 commit 84c652e

File tree

2 files changed

+6
-6
lines changed
  • lib/node_modules/@stdlib/assert

2 files changed

+6
-6
lines changed

lib/node_modules/@stdlib/assert/deep-has-own-property/lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ function deepHasOwnProp( value, path, options ) {
7474
throw err;
7575
}
7676
}
77+
if ( value === void 0 || value === null ) {
78+
return false;
79+
}
7780
if ( isStr ) {
7881
props = path.split( opts.sep );
7982
} else {
8083
props = path;
8184
}
82-
if ( value === void 0 || value === null ) {
83-
return false;
84-
}
8585
return has( value, props );
8686
} // end FUNCTION deepHasOwnProp()
8787

lib/node_modules/@stdlib/assert/deep-has-property/lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ function deepHasProp( value, path, options ) {
8484
throw err;
8585
}
8686
}
87+
if ( value === void 0 || value === null ) {
88+
return false;
89+
}
8790
if ( isStr ) {
8891
props = path.split( opts.sep );
8992
} else {
9093
props = path;
9194
}
92-
if ( value === void 0 || value === null ) {
93-
return false;
94-
}
9595
return has( value, props );
9696
} // end FUNCTION deepHasProp()
9797

0 commit comments

Comments
 (0)