From 3ee45c46219b7df4f80cfdb85892b9e9f73dbe94 Mon Sep 17 00:00:00 2001 From: Armand Abric Date: Mon, 9 Jan 2017 11:41:01 +0100 Subject: [PATCH 1/2] Change the instanciation method to be compatible with the native node class --- src/ObjectHelper.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ObjectHelper.js b/src/ObjectHelper.js index 922ceeb..8b234dd 100644 --- a/src/ObjectHelper.js +++ b/src/ObjectHelper.js @@ -19,12 +19,9 @@ ObjectHelper.clone = function clone(object) { * @return {*} */ ObjectHelper.createInstance = function createInstance(constructor, newInstanceArguments) { - // From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply#Using_apply_to_chain_constructors - var proxyConstructor = Object.create(constructor.prototype); - - constructor.apply(proxyConstructor, newInstanceArguments); - - return proxyConstructor; + // This solution come from babel. + // Try it here: http://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015&code=%0Aclass%20Bar%20%7B%0A%7D%0A%0Anew%20Bar(...%5B1%2C%202%5D)%3B + return new (Function.prototype.bind.apply(constructor, [null].concat(newInstanceArguments)))(); }; module.exports = ObjectHelper; From 3f755879d6500332b663db0958e3c07f672a4096 Mon Sep 17 00:00:00 2001 From: Armand Abric Date: Mon, 9 Jan 2017 11:43:05 +0100 Subject: [PATCH 2/2] Use yarn instead of npm to run script --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8d6f69..5c61d01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,9 @@ node_js: - "4.4" script: - - npm test - - npm run lint - - npm run coverage && npm run coverage-upload + - yarn run test + - yarn run lint + - yarn run coverage && yarn run coverage-upload notifications: email: