[Pkg-javascript-commits] [node-create-hash] 13/40: browser: cleanup

Bastien Roucariès rouca at moszumanska.debian.org
Sat May 27 14:10:34 UTC 2017


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

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

commit 82b3ba43b709063aad884accbf9cd619ac1b3805
Author: Daniel Cousens <github at dcousens.com>
Date:   Thu Jan 29 11:27:42 2015 +1100

    browser: cleanup
---
 browser.js | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/browser.js b/browser.js
index 3e904f7..29673a8 100644
--- a/browser.js
+++ b/browser.js
@@ -1,26 +1,29 @@
 'use strict';
-var sha = require('sha.js')
+var inherits = require('inherits')
 var md5 = require('./md5')
 var rmd160 = require('ripemd160')
-var Transform = require('stream').Transform;
-var inherits = require('inherits')
+var sha = require('sha.js')
+
+var Transform = require('stream').Transform
 
 function HashNoConstructor(hash) {
-  Transform.call(this);
+  Transform.call(this)
+
   this._hash = hash
   this.buffers = []
 }
 
 inherits(HashNoConstructor, Transform)
 
-HashNoConstructor.prototype._transform = function (data, _, done) {
+HashNoConstructor.prototype._transform = function (data, _, next) {
   this.buffers.push(data)
-  done()
+
+  next()
 }
 
-HashNoConstructor.prototype._flush = function (done) {
+HashNoConstructor.prototype._flush = function (next) {
   this.push(this.digest())
-  done()
+  next()
 }
 
 HashNoConstructor.prototype.update = function (data, enc) {
@@ -42,24 +45,25 @@ HashNoConstructor.prototype.digest = function (enc) {
 
 function Hash(hash) {
   Transform.call(this)
+
   this._hash = hash
 }
 
 inherits(Hash, Transform)
 
-Hash.prototype._transform = function (data, enc, done) {
+Hash.prototype._transform = function (data, enc, next) {
   if (enc) data = new Buffer(data, enc)
 
   this._hash.update(data)
 
-  done()
+  next()
 }
 
-Hash.prototype._flush = function (done) {
+Hash.prototype._flush = function (next) {
   this.push(this._hash.digest())
   this._hash = null
 
-  done()
+  next()
 }
 
 Hash.prototype.update = function (data, enc) {
@@ -80,5 +84,6 @@ Hash.prototype.digest = function (enc) {
 module.exports = function createHash (alg) {
   if ('md5' === alg) return new HashNoConstructor(md5)
   if ('rmd160' === alg) return new HashNoConstructor(rmd160)
+
   return new Hash(sha(alg))
 }

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



More information about the Pkg-javascript-commits mailing list