[Pkg-javascript-commits] [node-hash.js] 09/29: Use the `inherits` module.

Bastien Roucariès rouca at moszumanska.debian.org
Thu Apr 20 19:30:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-hash.js.

commit 34d6eaa4d6d3d6d5ffd9cf91dd85b1d227952bf3
Author: Terin Stock <terinjokes at gmail.com>
Date:   Thu May 8 22:07:16 2014 -0400

    Use the `inherits` module.
---
 lib/hash/utils.js | 26 ++------------------------
 package.json      |  3 +++
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/lib/hash/utils.js b/lib/hash/utils.js
index 55e14f0..d00a0e8 100644
--- a/lib/hash/utils.js
+++ b/lib/hash/utils.js
@@ -1,4 +1,5 @@
 var utils = exports;
+var inherits = require('inherits');
 
 function toArray(msg, enc) {
   if (Array.isArray(msg))
@@ -171,27 +172,4 @@ function assert(cond, msg) {
 }
 utils.assert = assert;
 
-// Shamelessly copied from browserify
-if (typeof Object.create === 'function') {
-  // implementation from standard node.js 'util' module
-  utils.inherits = function inherits(ctor, superCtor) {
-    ctor.super_ = superCtor
-    ctor.prototype = Object.create(superCtor.prototype, {
-      constructor: {
-        value: ctor,
-        enumerable: false,
-        writable: true,
-        configurable: true
-      }
-    });
-  };
-} else {
-  // old school shim for old browsers
-  utils.inherits = function inherits(ctor, superCtor) {
-    ctor.super_ = superCtor
-    var TempCtor = function () {}
-    TempCtor.prototype = superCtor.prototype
-    ctor.prototype = new TempCtor()
-    ctor.prototype.constructor = ctor
-  }
-}
+utils.inherits = inherits;
diff --git a/package.json b/package.json
index 7c4a271..5901a13 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,9 @@
     "url": "https://github.com/indutny/hash.js/issues"
   },
   "homepage": "https://github.com/indutny/hash.js",
+  "dependencies": {
+    "inherits": "^2.0.1"
+  },
   "devDependencies": {
     "mocha": "^1.18.2"
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-hash.js.git



More information about the Pkg-javascript-commits mailing list