Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a1111ee

Browse files
addaleaxnfischer
authored andcommitted
Silence potentially upcoming circular dependency warning (#973)
Node.js is currently considering printing a warning when a non-existent property of `module.exports` is accessed while in a circular `require()` dependency, in order to make it easier to catch issues with circular dependencies. In order to avoid printing these warnings for shelljs, checking for the property’s existence rather than its truthiness suffices. Refs: nodejs/node#29935
1 parent d4d1317 commit a1111ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ function _register(name, implementation, wrapOptions) {
450450
// If an option isn't specified, use the default
451451
wrapOptions = Object.assign({}, DEFAULT_WRAP_OPTIONS, wrapOptions);
452452

453-
if (shell[name]) {
453+
if (shell.hasOwnProperty(name)) {
454454
throw new Error('Command `' + name + '` already exists');
455455
}
456456

0 commit comments

Comments
 (0)