Skip to content
Browse files

Make weak usage optional

Currently weak does not compile on 0.11.5. This fix allows usage of dnode on 0.11 without having to wait for weak to be fixed.
  • Loading branch information...
1 parent 6ce5c03 commit 34d1c9aa9696f13bdf8fb99d9d039367ad873f90 @Raynos Raynos committed with
Showing with 5 additions and 1 deletion.
  1. +5 −1 index.js
View
6 index.js
@@ -2,7 +2,7 @@ var dnode = require('./lib/dnode');
var parseArgs = require('./lib/parse_args');
var net = require('net');
var util = require('util');
-var weak = require('weak');
+var weak
exports = module.exports = function (cons, opts) {
return new D(cons, opts);
@@ -24,6 +24,10 @@ function D (cons, opts) {
if (!opts) opts = {};
if (opts.weak !== false && !opts.proto) {
+ if (!weak) {
+ weak = require("weak")
+ }
+
opts.proto = {};
opts.proto.wrap = function (cb, id) {
var proto = this;

0 comments on commit 34d1c9a

Please sign in to comment.
Something went wrong with that request. Please try again.