Skip to content

Commit

Permalink
[weakref] disable in node >=12
Browse files Browse the repository at this point in the history
`weak-napi` potentially causes segfault on node >=12

node-ffi-napi/weak-napi#16
  • Loading branch information
JorgenEvens committed Feb 20, 2020
1 parent e9e8e33 commit e2d646e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var LruCache = require('./cache/lru');
var weak = require('weak-napi');
var weak = require('./weakref');

function noop(v) { return v; }
function is(v, type) { return typeof v === type; }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Throttle depending on function arguments.",
"main": "index.js",
"browser": {
"weak-napi": "./browser-weakref"
"./weakref": "./weakref-browser"
},
"engines": {
"node": "6.x.x"
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions weakref.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const nodeMajorVersion = parseInt(process.versions.node.replace(/\..*/, ''));

module.exports = nodeMajorVersion >= 12 ?
require('./weakref-browser') : // https://github.com/node-ffi-napi/weak-napi/issues/16
require('weak-napi');

0 comments on commit e2d646e

Please sign in to comment.