From ecd885a42ebf013ee3217bb75e6d4ee45936b7e1 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Kyohei Date: Fri, 22 Sep 2017 19:19:54 +0900 Subject: [PATCH] Add check for Windows platform Now we can safely import/require this library without crashing under non-Windows environment. --- index.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index ae590d1..8811d6b 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,12 @@ -module.exports = { - registry: require('./lib/registry'), - error: require('./lib/error'), - types: require('./lib/types'), - windef: require('./lib/windef'), - Key: require('./lib/key'), - utils: require('./lib/utils') -}; \ No newline at end of file +if (process.platform == "win32") { + module.exports = { + registry: require('./lib/registry'), + error: require('./lib/error'), + types: require('./lib/types'), + windef: require('./lib/windef'), + Key: require('./lib/key'), + utils: require('./lib/utils') + }; +} else { + module.exports = void 0; +}