From c2eefa38ee1146fccf886b5ac81d0c7b4e7beafa Mon Sep 17 00:00:00 2001 From: John French Date: Fri, 4 May 2018 11:34:48 -0400 Subject: [PATCH] Use built-in N-API on Node.js >= 6.14.2 Update the version ranges in index.js to reflect that N-API is now available in Node.js 6.x as of v6.14.2. PR-URL: https://github.com/nodejs/node-addon-api/pull/263 Reviewed-By: Hitesh Kanwathirtha Reviewed-By: Kyle Farnung Reviewed-By: Michael Dawson --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 87c2e68..77dc6d4 100644 --- a/index.js +++ b/index.js @@ -14,8 +14,10 @@ var versionArray = process.version // We know which version of Node.js first shipped the incarnation of the API // available in *this* package. So, if we find that the Node.js version is below // that, we indicate that the API is missing from Node.js. -var isNodeApiBuiltin = - (versionArray[0] > 8 || (versionArray[0] == 8 && versionArray[1] > 5)); +var isNodeApiBuiltin = ( + versionArray[0] > 8 || + (versionArray[0] == 8 && versionArray[1] >= 6) || + (versionArray[0] == 6 && versionArray[1] >= 14 && versionArray[2] >= 2)); // The flag is not needed when the Node version is not 8, nor if the API is // built-in, because we removed the flag at the same time as creating the final