From a6bb08e9bed24bf25787ecd88851c9fa99e11afa Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 18 Oct 2019 23:09:08 +0200 Subject: [PATCH] Silence potentially upcoming circular dependency warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/29935 --- src/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index d65654e3..0ec1f813 100644 --- a/src/common.js +++ b/src/common.js @@ -478,7 +478,7 @@ function _register(name, implementation, wrapOptions) { // If an option isn't specified, use the default wrapOptions = Object.assign({}, DEFAULT_WRAP_OPTIONS, wrapOptions); - if (shell[name]) { + if (shell.hasOwnProperty(name)) { throw new Error('Command `' + name + '` already exists'); }