Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

are-we-there-yet

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

are-we-there-yet - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

38

index.js
"use strict"
var stream = require("readable-stream");
var stream = require("readable-stream")
var EventEmitter = require("events").EventEmitter

@@ -7,2 +7,8 @@ var util = require("util")

function noteChange (trackerGroup) {
return function (name) {
trackerGroup.emit('change', name || trackerGroup.name);
}
}
var TrackerGroup = exports.TrackerGroup = function (name) {

@@ -12,10 +18,4 @@ EventEmitter.call(this)

this.trackGroup = []
var self = this
this.totalWeight = 0
var noteChange = this.noteChange = function (name) {
self.emit("change", name || this.name)
}.bind(this)
this.trackGroup.forEach(function(unit) {
unit.on("change", noteChange)
})
this.noteChange = noteChange(this)
}

@@ -28,5 +28,6 @@ util.inherits(TrackerGroup, EventEmitter)

var completed = 0
this.trackGroup.forEach(function(T) {
completed += valPerWeight * T.weight * T.completed()
})
for (var i = 0, len = this.trackGroup.length; i < len; i++){
var group = this.trackGroup[i];
completed += valPerWeight * group.weight * group.completed()
}
return completed

@@ -39,2 +40,3 @@ }

this.trackGroup.push(unit)
// Bubble events back up
unit.on("change", this.noteChange)

@@ -58,8 +60,8 @@ if (! noChange) this.emit("change", this.name)

TrackerGroup.prototype.finish = function () {
if (! this.trackGroup.length) { this.addUnit(new Tracker(), 1, true) }
var self = this
this.trackGroup.forEach(function(T) {
T.removeListener("change", self.noteChange)
T.finish()
})
if (! this.trackGroup.length) this.addUnit(new Tracker(), 1, true)
for (var i = 0, len = this.trackGroup.length; i < len; i++) {
var group = this.trackGroup[i]
group.removeListener("change", this.noteChange)
group.finish()
}
this.emit("change", this.name)

@@ -93,3 +95,3 @@ }

Tracker.prototype.completed = function () {
return this.workTodo==0 ? 0 : this.workDone / this.workTodo
return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
}

@@ -96,0 +98,0 @@

{
"name": "are-we-there-yet",
"version": "1.0.5",
"version": "1.0.6",
"description": "Keep track of the overall completion of many dispirate processes",

@@ -20,8 +20,8 @@ "main": "index.js",

"devDependencies": {
"tap": "^0.4.13"
"tap": "^5.2.0"
},
"dependencies": {
"delegates": "^0.1.0",
"delegates": "^1.0.0",
"readable-stream": "^2.0.0 || ^1.1.13"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc