Comparing version 0.5.13 to 0.5.14
28
do.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
const chain = function(fn, ...args) { | ||
const chain = function (fn, ...args) { | ||
const current = done => { | ||
@@ -25,7 +25,7 @@ if (done) current.done = done; | ||
Do.prototype.do = function(fn, ...args) { | ||
Do.prototype.do = function (fn, ...args) { | ||
return chain.call(this, fn, ...args); | ||
}; | ||
Do.prototype.forward = function() { | ||
Do.prototype.forward = function () { | ||
if (this.fn) | ||
@@ -44,3 +44,3 @@ this.fn(...this.args, (err, data) => { | ||
Collector.prototype.collect = function(key, err, value) { | ||
Collector.prototype.collect = function (key, err, value) { | ||
if (this.finished) return this; | ||
@@ -68,3 +68,3 @@ if (err) { | ||
Collector.prototype.pick = function(key, value) { | ||
Collector.prototype.pick = function (key, value) { | ||
this.collect(key, null, value); | ||
@@ -74,3 +74,3 @@ return this; | ||
Collector.prototype.fail = function(key, err) { | ||
Collector.prototype.fail = function (key, err) { | ||
this.collect(key, err); | ||
@@ -80,3 +80,3 @@ return this; | ||
Collector.prototype.take = function(key, fn, ...args) { | ||
Collector.prototype.take = function (key, fn, ...args) { | ||
fn(...args, (err, data) => { | ||
@@ -88,7 +88,7 @@ this.collect(key, err, data); | ||
Collector.prototype.callback = function(key) { | ||
Collector.prototype.callback = function (key) { | ||
return (...args) => this(key, ...args); | ||
}; | ||
Collector.prototype.timeout = function(msec) { | ||
Collector.prototype.timeout = function (msec) { | ||
if (this.timer) { | ||
@@ -107,3 +107,3 @@ clearTimeout(this.timer); | ||
Collector.prototype.done = function(callback) { | ||
Collector.prototype.done = function (callback) { | ||
this.finish = callback; | ||
@@ -113,3 +113,3 @@ return this; | ||
Collector.prototype.finalize = function(key, err, data) { | ||
Collector.prototype.finalize = function (key, err, data) { | ||
if (this.finished) return this; | ||
@@ -127,3 +127,3 @@ if (this.finish) { | ||
Collector.prototype.distinct = function(value = true) { | ||
Collector.prototype.distinct = function (value = true) { | ||
this.unique = value; | ||
@@ -133,3 +133,3 @@ return this; | ||
Collector.prototype.cancel = function(err) { | ||
Collector.prototype.cancel = function (err) { | ||
err = err || new Error('Collector cancelled'); | ||
@@ -140,3 +140,3 @@ this.finalize(err, this.data); | ||
Collector.prototype.then = function(fulfill, reject) { | ||
Collector.prototype.then = function (fulfill, reject) { | ||
this.finish = (err, result) => { | ||
@@ -143,0 +143,0 @@ if (err) reject(err); |
{ | ||
"name": "do", | ||
"version": "0.5.13", | ||
"version": "0.5.14", | ||
"description": "The simplest way to manage asynchronicity", | ||
@@ -51,8 +51,8 @@ "license": "MIT", | ||
"diff": "^4.0.2", | ||
"eslint": "^7.0.0", | ||
"eslint": "^7.6.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"metatests": "^0.7.1", | ||
"prettier": "^1.19.1" | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"metatests": "^0.7.2", | ||
"prettier": "^2.0.5" | ||
} | ||
} |
## "do" is the simplest way to manage asynchronicity | ||
[![TravisCI](https://travis-ci.org/metarhia/do.svg?branch=master)](https://travis-ci.org/metarhia/do) | ||
![CI Status Badge](https://github.com/metarhia/metadoc/workflows/Testing%20CI/badge.svg?branch=master) | ||
[![NPM Version](https://badge.fury.io/js/do.svg)](https://badge.fury.io/js/do) | ||
@@ -5,0 +5,0 @@ [![NPM Downloads/Month](https://img.shields.io/npm/dm/do.svg)](https://www.npmjs.com/package/do) |
Sorry, the diff of this file is not supported yet
20186
12
606