File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 11var path = require ( 'path' ) ;
22
3+ // We know which version of Node.js first shipped the incarnation of the API
4+ // available in *this* package. So, if we find that the Node.js version is below
5+ // that, we indicate that the API is missing from Node.js.
6+ function getNodeApiBuiltin ( ) {
7+ var versionArray = process . version
8+ . substr ( 1 )
9+ . split ( '.' )
10+ . map ( function ( item ) {
11+ return + item ;
12+ } ) ;
13+ return versionArray [ 0 ] >= 8 && versionArray [ 1 ] >= 4 && versionArray [ 2 ] >= 0 ;
14+ }
15+
316// TODO: Check if the main node semantic version is within multiple ranges,
417// or detect presence of built-in N-API by some other mechanism TBD.
5- var isNodeApiBuiltin = process . versions . modules >= 52 ; // Node 8.x
18+ var isNodeApiBuiltin = getNodeApiBuiltin ( ) ;
619
720var include = path . join ( __dirname , 'src' ) ;
821var gyp = path . join ( __dirname , 'src' , 'node_api.gyp' ) ;
You can’t perform that action at this time.
0 commit comments