From 5e58368919c1e066f67a3d4754902ef1059a1864 Mon Sep 17 00:00:00 2001 From: Mykola Bilochub Date: Fri, 19 Oct 2018 02:09:16 +0300 Subject: [PATCH] Use eslint-config-metarhia and fix linting issues Refs: https://github.com/metarhia/Metarhia/issues/22 --- .eslintrc.yml | 174 +------- lib/adapters.js | 27 +- lib/array.js | 4 +- lib/chain.js | 22 +- lib/collector.class.js | 9 +- lib/collector.functor.js | 22 +- lib/collector.js | 9 +- lib/collector.prototype.js | 4 +- lib/composition.js | 11 +- lib/do.js | 20 +- lib/fp.js | 11 +- lib/memoize.js | 13 +- lib/poolify.js | 7 +- lib/poolify.opt.js | 5 +- lib/poolify.symbol.js | 7 +- lib/queue.js | 12 +- lib/throttle.js | 2 +- package-lock.json | 661 ++++++++++++++++++++++++------- package.json | 4 +- test/adapters.js | 16 +- test/array.each.js | 12 +- test/array.every.js | 18 +- test/array.filter.js | 11 +- test/array.find.js | 10 +- test/array.map.js | 6 +- test/array.reduce.js | 12 +- test/array.series.js | 8 +- test/array.some.js | 8 +- test/chain.js | 1 + test/collectors.js | 60 +-- test/compose.clone.js | 2 +- test/compose.js | 18 +- test/compose.then.js | 6 +- test/control.js | 10 +- test/do.js | 7 +- test/firstOf.js | 6 +- test/fp.ap.js | 12 +- test/fp.asAsync.js | 4 +- test/fp.concat.js | 10 +- test/fp.fmap.js | 22 +- test/fp.of.js | 2 +- test/memoize.js | 12 +- test/poolify.js | 12 +- test/queue.js | 8 +- test/queue.modes.js | 12 +- test/throttle.js | 18 +- tests/all.js | 2 +- tests/collector.js | 7 + tests/composition.cancel.js | 6 +- tests/composition.js | 10 +- tests/composition.parallel.js | 6 +- tests/composition.pause.js | 10 +- tests/composition.sequential.js | 1 + tests/examples.js | 95 ++--- tests/load/benchmark.js | 3 + tests/load/collect.class.js | 2 +- tests/load/collect.functor.js | 2 +- tests/load/collect.js | 2 +- tests/load/collect.prototype.js | 2 +- tests/load/parallel.collect.js | 2 +- tests/load/parallel.compose.js | 2 +- tests/load/parallel.promise.js | 16 +- tests/load/poolify.array.js | 2 +- tests/load/poolify.opt.js | 2 +- tests/load/poolify.symbol.js | 2 +- tests/load/sequential.compose.js | 2 +- tests/load/sequential.promise.js | 16 +- 67 files changed, 879 insertions(+), 660 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index de3adce1..b327b9bf 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,173 +1 @@ -env: - es6: true - node: true -extends: 'eslint:recommended' -globals: - api: false -rules: - indent: - - error - - 2 - - SwitchCase: 1 - VariableDeclarator: - var: 2 - let: 2 - const: 3 - MemberExpression: 1 - linebreak-style: - - error - - unix - quotes: - - error - - single - semi: - - error - - always - eqeqeq: - - error - - always - no-loop-func: - - error - strict: - - error - - global - block-spacing: - - error - - always - brace-style: - - error - - 1tbs - - allowSingleLine: true - camelcase: - - error - comma-style: - - error - - last - comma-spacing: - - error - - before: false - after: true - eol-last: - - error - func-call-spacing: - - error - - never - key-spacing: - - error - - beforeColon: false - afterColon: true - mode: minimum - keyword-spacing: - - error - - before: true - after: true - overrides: - function: - after: false - max-len: - - error - - code: 80 - ignoreUrls: true - max-nested-callbacks: - - error - - max: 7 - new-cap: - - error - - newIsCap: true - capIsNew: true - properties: true - new-parens: - - error - no-lonely-if: - - error - no-trailing-spaces: - - error - no-unneeded-ternary: - - error - no-whitespace-before-property: - - error - object-curly-spacing: - - error - - always - operator-assignment: - - error - - always - operator-linebreak: - - error - - after - semi-spacing: - - error - - before: false - after: true - space-before-blocks: - - error - - always - space-before-function-paren: - - error - - never - space-in-parens: - - error - - never - space-infix-ops: - - error - space-unary-ops: - - error - - words: true - nonwords: false - overrides: - typeof: false - no-unreachable: - - error - no-global-assign: - - error - no-self-compare: - - error - no-unmodified-loop-condition: - - error - no-constant-condition: - - error - - checkLoops: false - no-console: - - off - no-useless-concat: - - error - no-useless-escape: - - error - no-shadow-restricted-names: - - error - no-use-before-define: - - error - - functions: false - arrow-body-style: - - error - - as-needed - arrow-spacing: - - error - no-confusing-arrow: - - error - - allowParens: true - no-useless-computed-key: - - error - no-useless-rename: - - error - no-var: - - error - object-shorthand: - - error - - always - prefer-arrow-callback: - - error - prefer-const: - - error - prefer-numeric-literals: - - error - prefer-rest-params: - - error - prefer-spread: - - error - rest-spread-spacing: - - error - - never - template-curly-spacing: - - error - - never +extends: 'metarhia' diff --git a/lib/adapters.js b/lib/adapters.js index 8a95699e..40956d3e 100644 --- a/lib/adapters.js +++ b/lib/adapters.js @@ -2,11 +2,10 @@ const common = require('metarhia-common'); -const callbackify = ( - // Convert source to callback-last contract - source // promise or regular synchronous function - // Returns: callback, function -) => { +// Convert source to callback-last contract +// source - promise or regular synchronous function +// Returns: callback, function +const callbackify = source => { if (typeof source === 'function') { return (...args) => { const callback = common.unsafeCallback(args); @@ -27,11 +26,10 @@ const callbackify = ( } }; -const promisify = ( - // Convert async function to Promise object - func // function, callback-last function - // Returns: object, Promise instance -) => { +// Convert async function to Promise object +// func - function, callback-last function +// Returns: object, Promise instance +const promisify = func => { const promisified = (...args) => { const promise = new Promise((resolve, reject) => { func(...args, (err, data) => { @@ -44,11 +42,10 @@ const promisify = ( return promisified; }; -const promisifySync = ( - // Convert sync function to Promise object - func // function, regular synchronous function - // Returns: object, Promise instance -) => (...args) => new Promise((resolve, reject) => { +// Convert sync function to Promise object +// func - function, regular synchronous function +// Returns: object, Promise instance +const promisifySync = func => (...args) => new Promise((resolve, reject) => { const result = func(...args); if (result instanceof Error) reject(result); else resolve(result); diff --git a/lib/array.js b/lib/array.js index 45e9a191..f9d3be71 100644 --- a/lib/array.js +++ b/lib/array.js @@ -147,7 +147,7 @@ const each = ( let count = 0; let errored = false; - const next = (err) => { + const next = err => { if (errored) return; if (err) { errored = true; @@ -181,7 +181,7 @@ const series = ( done(null, items); return; } - fn(items[i], (err) => { + fn(items[i], err => { if (err) { done(err); return; diff --git a/lib/chain.js b/lib/chain.js index 8cb8dd20..aa4beced 100644 --- a/lib/chain.js +++ b/lib/chain.js @@ -11,6 +11,7 @@ const async = op => { case 'series': return series; case 'find': return find; } + return null; }; function ArrayChain(array) { @@ -23,7 +24,7 @@ ArrayChain.prototype.execute = function(err) { if (!item.op) { if (err) throw err; - else return; + else return null; } const next = (err, data) => { @@ -37,7 +38,7 @@ ArrayChain.prototype.execute = function(err) { if (err) { this.execute(err); - return; + return null; } if (item.isSync) { @@ -47,6 +48,8 @@ ArrayChain.prototype.execute = function(err) { const op = async(item.op); op(this.array, item.fn, next); } + + return null; }; ArrayChain.prototype.fetch = function(fn) { @@ -90,15 +93,15 @@ const syncDelegates = { opNames: ['concat', 'slice', 'includes'], handler(op, ...args) { return this.array[op](...args); - } + }, }, modify: { opNames: ['reverse', 'sort', 'shift', 'unshift', 'push', 'pop'], handler(op, ...args) { this.array[op](...args); return this.array; - } - } + }, + }, }; for (const delegateType in syncDelegates) { @@ -112,11 +115,10 @@ for (const delegateType in syncDelegates) { } } -const forArrayChain = ( - // Create an ArrayChain instance - array // array, start mutations from this data - // Returns: ArrayChain instance -) => ( +// Create an ArrayChain instance +// array - array, start mutations from this data +// Returns: ArrayChain instance +const forArrayChain = array => ( new ArrayChain(array) ); diff --git a/lib/collector.class.js b/lib/collector.class.js index c096defb..1453ce7d 100644 --- a/lib/collector.class.js +++ b/lib/collector.class.js @@ -115,11 +115,10 @@ class Collector { } } -const collect = ( - // Collector instance constructor - expected // number or array of string, - // Returns: Collector, instance -) => ( +// Collector instance constructor +// expected - number or array of string, +// Returns: Collector, instance +const collect = expected => ( new Collector(expected) ); diff --git a/lib/collector.functor.js b/lib/collector.functor.js index 52032fae..532e0af6 100644 --- a/lib/collector.functor.js +++ b/lib/collector.functor.js @@ -3,11 +3,10 @@ const TYPE_ERROR = 'Metasync: Collect unexpected type'; const COLLECT_TIMEOUT = 'Metasync: Collector timed out'; -const collect = ( - // Collector instance constructor - expected // number or array of string, count or keys - // Returns: functor, collector -) => { +// Collector instance constructor +// expected - number or array of string, count or keys +// Returns: functor, collector +const collect = expected => { const isCount = typeof expected === 'number'; const isKeys = Array.isArray(expected); if (!(isCount || isKeys)) throw new TypeError(TYPE_ERROR); @@ -26,12 +25,12 @@ const collect = ( const collector = (key, err, value) => { if (isDone) return collector; if (!isDistinct || !(key in data)) { - if (!isCount && !keys.has(key)) return; + if (!isCount && !keys.has(key)) return null; count++; } if (err) { collector.finalize(err, data); - return; + return null; } data[key] = value; if (expected === count) { @@ -50,7 +49,7 @@ const collect = ( return collector; }, - timeout: (msec) => { + timeout: msec => { if (msec) { timer = setTimeout(() => { const err = new Error(COLLECT_TIMEOUT); @@ -61,9 +60,8 @@ const collect = ( return collector; }, - done: ( - callback // function, (error, data) - ) => { + // callback - function, (error, data) + done: callback => { onDone = callback; return collector; }, @@ -78,7 +76,7 @@ const collect = ( distinct: (value = true) => { isDistinct = value; return collector; - } + }, }; return Object.assign(collector, methods); diff --git a/lib/collector.js b/lib/collector.js index 57b43f56..43482d01 100644 --- a/lib/collector.js +++ b/lib/collector.js @@ -112,11 +112,10 @@ Collector.prototype.then = function(fulfill, reject) { return this; }; -const collect = ( - // Collector instance constructor - expected // number or array of string, - // Returns: Collector, instance -) => ( +// Collector instance constructor +// expected - number or array of string, +// Returns: Collector, instance +const collect = expected => ( new Collector(expected) ); diff --git a/lib/collector.prototype.js b/lib/collector.prototype.js index d2017833..747c8a14 100644 --- a/lib/collector.prototype.js +++ b/lib/collector.prototype.js @@ -42,7 +42,7 @@ const DataCollector = function( this.events = { error: null, timeout: null, - done: null + done: null, }; if (this.timeout) { this.timer = setTimeout(() => { @@ -89,7 +89,7 @@ const KeyCollector = function( this.events = { error: null, timeout: null, - done: null + done: null, }; const collector = this; if (this.timeout) { diff --git a/lib/composition.js b/lib/composition.js index 0519428b..fea8b441 100644 --- a/lib/composition.js +++ b/lib/composition.js @@ -5,11 +5,10 @@ function Composition() {} const COMPOSE_CANCELED = 'Metasync: asynchronous composition canceled'; const COMPOSE_TIMEOUT = 'Metasync: asynchronous composition timed out'; -const compose = ( - // Asynchronous functions composition - flow // array of functions, callback-last / err-first - // Returns: function, composed callback-last / err-first -) => { +// Asynchronous functions composition +// flow - array of functions, callback-last / err-first +// Returns: function, composed callback-last / err-first +const compose = flow => { const comp = (data, callback) => { if (!callback) { if (typeof data === 'function') { @@ -152,7 +151,7 @@ Composition.prototype.sequential = function() { Composition.prototype.then = function(fulfill, reject) { if (this.canceled) { reject(new Error(COMPOSE_CANCELED)); - return; + return this; } this((err, result) => { if (err) reject(err); diff --git a/lib/do.js b/lib/do.js index 5c5f46b3..c72a4206 100644 --- a/lib/do.js +++ b/lib/do.js @@ -3,7 +3,7 @@ function Do() {} const chain = (fn, ...args) => { - const current = (done) => { + const current = done => { if (done) current.done = done; if (current.prev) { current.prev.next = current; @@ -26,14 +26,16 @@ Do.prototype.do = function(fn, ...args) { }; Do.prototype.forward = function() { - if (this.fn) this.fn(...this.args, (err, data) => { - const next = this.next; - if (next) { - if (next.fn) next.forward(); - } else if (this.done) { - this.done(err, data); - } - }); + if (this.fn) { + this.fn(...this.args, (err, data) => { + const next = this.next; + if (next) { + if (next.fn) next.forward(); + } else if (this.done) { + this.done(err, data); + } + }); + } }; module.exports = { do: chain }; diff --git a/lib/fp.js b/lib/fp.js index 2f219c38..75d573b3 100644 --- a/lib/fp.js +++ b/lib/fp.js @@ -2,12 +2,11 @@ let asyncChainMethods = null; -const toAsync = ( - // Transforms function with args arguments and callback - // to function with args as separate values and callback - fn // function, callback-last / err-first - // Returns: function -) => (...argsCb) => { +// Transforms function with args arguments and callback +// to function with args as separate values and callback +// fn - function, callback-last / err-first +// Returns: function +const toAsync = fn => (...argsCb) => { const len = argsCb.length - 1; const callback = argsCb[len]; const args = argsCb.slice(0, len); diff --git a/lib/memoize.js b/lib/memoize.js index d6f7d87f..a2a31fa4 100644 --- a/lib/memoize.js +++ b/lib/memoize.js @@ -2,11 +2,10 @@ function Memoized() {} -const memoize = ( - // Create memoized function - fn // function, sync or async - // Returns: function, memoized -) => { +// Create memoized function +// fn - function, sync or async +// Returns: function, memoized +const memoize = fn => { const cache = new Map(); const memoized = function(...args) { @@ -37,8 +36,8 @@ const memoize = ( overflow: null, add: null, del: null, - clear: null - } + clear: null, + }, }; Object.setPrototypeOf(memoized, Memoized.prototype); diff --git a/lib/poolify.js b/lib/poolify.js index 29873c3b..1128382d 100644 --- a/lib/poolify.js +++ b/lib/poolify.js @@ -10,7 +10,7 @@ const provide = callback => item => { const poolify = (factory, min, norm, max) => { let allocated = norm; - const pool = (par) => { + const pool = par => { if (Array.isArray(par)) { while (par.length) { const item = par.shift(); @@ -18,7 +18,7 @@ const poolify = (factory, min, norm, max) => { if (delayed) delayed(item); else pool.items.push(item); } - return; + return undefined; } if (pool.items.length < min && allocated < max) { const grow = Math.min(max - allocated, norm - pool.items.length); @@ -31,10 +31,11 @@ const poolify = (factory, min, norm, max) => { const callback = provide(par); if (res) callback(res); else pool.delayed.push(callback); + return undefined; }; return Object.assign(pool, { items: duplicate(factory, norm), - delayed: [] + delayed: [], }); }; diff --git a/lib/poolify.opt.js b/lib/poolify.opt.js index 2f090a7d..26d19cea 100644 --- a/lib/poolify.opt.js +++ b/lib/poolify.opt.js @@ -12,7 +12,7 @@ const poolify = (factory, min, norm, max) => { let allocated = norm; const items = duplicate(factory, norm); const delayed = []; - return (par) => { + return par => { if (Array.isArray(par)) { while (par.length) { const item = par.shift(); @@ -20,7 +20,7 @@ const poolify = (factory, min, norm, max) => { if (request) request(item); else items.push(item); } - return; + return undefined; } if (items.length < min && allocated < max) { const grow = Math.min(max - allocated, norm - items.length); @@ -33,6 +33,7 @@ const poolify = (factory, min, norm, max) => { const callback = provide(par); if (res) callback(res); else delayed.push(callback); + return undefined; }; }; diff --git a/lib/poolify.symbol.js b/lib/poolify.symbol.js index 007d61db..a4739703 100644 --- a/lib/poolify.symbol.js +++ b/lib/poolify.symbol.js @@ -16,12 +16,12 @@ const provide = callback => item => { const poolify = (factory, min, norm, max) => { let allocated = norm; - const pool = (par) => { + const pool = par => { if (par && par[poolified]) { const delayed = pool.delayed.shift(); if (delayed) delayed(par); else pool.items.push(par); - return; + return undefined; } if (pool.items.length < min && allocated < max) { const grow = Math.min(max - allocated, norm - pool.items.length); @@ -34,10 +34,11 @@ const poolify = (factory, min, norm, max) => { const callback = provide(par); if (res) callback(res); else pool.delayed.push(callback); + return undefined; }; return Object.assign(pool, { items: duplicate(factory, norm), - delayed: [] + delayed: [], }); }; diff --git a/lib/queue.js b/lib/queue.js index 1aeba4bb..927f0178 100644 --- a/lib/queue.js +++ b/lib/queue.js @@ -136,6 +136,7 @@ Queue.prototype.takeNext = function( } const task = tasks.shift(); if (task) this.next(task); + return this; }; Queue.prototype.pause = function( @@ -249,18 +250,17 @@ Queue.prototype.pipe = function( dest // Queue, destination queue ) { if (dest instanceof Queue) { - this.success((item) => { + this.success(item => { dest.add(item); }); } return this; }; -const queue = ( - // Queue instantiation - concurrency // number, of simultaneous and asynchronously executing tasks - // Returns: Queue, instance -) => ( +// Queue instantiation +// concurrency - number, of simultaneous and asynchronously executing tasks +// Returns: Queue, instance +const queue = concurrency => ( new Queue(concurrency) ); diff --git a/lib/throttle.js b/lib/throttle.js index 931e4135..63bf7af1 100644 --- a/lib/throttle.js +++ b/lib/throttle.js @@ -68,7 +68,7 @@ const timeout = ( if (!finished) { clearTimeout(timer); finished = true; - return callback(...args); + callback(...args); } }); }; diff --git a/package-lock.json b/package-lock.json index 68b96583..25134526 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,63 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "@webassemblyjs/ast": { "version": "1.7.8", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.8.tgz", @@ -214,20 +271,12 @@ } }, "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz", + "integrity": "sha512-JY+iV6r+cO21KtntVvFkD+iqjtdpRUpGqKWgfkCdZq1R+kbreEl8EcdcJR4SmiIgsIQT33s6QzheQ9a275Q8xw==", "dev": true, "requires": { - "acorn": "^3.0.4" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } + "acorn": "^5.0.3" } }, "after": { @@ -241,6 +290,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, + "optional": true, "requires": { "co": "^4.6.0", "fast-deep-equal": "^1.0.0", @@ -248,12 +298,6 @@ "json-schema-traverse": "^0.3.0" } }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, "ansi-escapes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", @@ -1445,6 +1489,12 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -1551,9 +1601,9 @@ } }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "chokidar": { @@ -1653,7 +1703,8 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true + "dev": true, + "optional": true }, "collection-visit": { "version": "1.0.0", @@ -1780,6 +1831,12 @@ "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", "dev": true }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", @@ -1868,12 +1925,14 @@ } }, "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { - "lru-cache": "^4.0.1", + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" } @@ -2287,6 +2346,15 @@ "prr": "~1.0.1" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "es5-ext": { "version": "0.10.46", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz", @@ -2339,51 +2407,63 @@ "dev": true }, "eslint": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", - "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.7.0.tgz", + "integrity": "sha512-zYCeFQahsxffGl87U2aJ7DPyH8CbWgxBC213Y8+TCanhUTf2gEvfq3EKpHmEcozTLyPmGe9LZdMAwC/CpJBM5A==", "dev": true, "requires": { - "ajv": "^5.3.0", - "babel-code-frame": "^6.22.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", "chalk": "^2.1.0", - "concat-stream": "^1.6.0", - "cross-spawn": "^5.1.0", - "debug": "^3.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", "doctrine": "^2.1.0", - "eslint-scope": "^3.7.1", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", "eslint-visitor-keys": "^1.0.0", - "espree": "^3.5.4", - "esquery": "^1.0.0", + "espree": "^4.0.0", + "esquery": "^1.0.1", "esutils": "^2.0.2", "file-entry-cache": "^2.0.0", "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", - "globals": "^11.0.1", - "ignore": "^3.3.3", + "globals": "^11.7.0", + "ignore": "^4.0.6", "imurmurhash": "^0.1.4", - "inquirer": "^3.0.6", - "is-resolvable": "^1.0.0", - "js-yaml": "^3.9.1", + "inquirer": "^6.1.0", + "is-resolvable": "^1.1.0", + "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.4", - "minimatch": "^3.0.2", + "lodash": "^4.17.5", + "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "optionator": "^0.8.2", "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^1.0.1", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", - "semver": "^5.3.0", + "semver": "^5.5.1", "strip-ansi": "^4.0.0", - "strip-json-comments": "~2.0.1", - "table": "4.0.2", - "text-table": "~0.2.0" + "strip-json-comments": "^2.0.1", + "table": "^5.0.2", + "text-table": "^0.2.0" }, "dependencies": { + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", @@ -2411,18 +2491,42 @@ } }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, "globals": { - "version": "11.7.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", - "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, "strip-ansi": { @@ -2435,9 +2539,9 @@ } }, "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { "has-flag": "^3.0.0" @@ -2445,16 +2549,108 @@ } } }, + "eslint-config-metarhia": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-metarhia/-/eslint-config-metarhia-5.0.0.tgz", + "integrity": "sha512-m5duvNQiqeco7uQZYyTkZPUW6kNzsPexTW4Roo0GE+hTayJLEQlhKKLDZlbqhKEjg1nobSwUTN9NV6x+p3x6WQ==", + "dev": true + }, + "eslint-import-resolver-node": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", + "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.5.0" + } + }, + "eslint-module-utils": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", + "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", + "dev": true, + "requires": { + "debug": "^2.6.8", + "pkg-dir": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "pkg-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", + "dev": true, + "requires": { + "find-up": "^1.0.0" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", + "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", + "dev": true, + "requires": { + "contains-path": "^0.1.0", + "debug": "^2.6.8", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.1", + "eslint-module-utils": "^2.2.0", + "has": "^1.0.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.3", + "read-pkg-up": "^2.0.0", + "resolve": "^1.6.0" + }, + "dependencies": { + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + } + } + }, "eslint-scope": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", - "integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", "dev": true, "requires": { "esrecurse": "^4.1.0", "estraverse": "^4.1.1" } }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, "eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", @@ -2462,13 +2658,13 @@ "dev": true }, "espree": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", - "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.0.0.tgz", + "integrity": "sha512-kapdTCt1bjmspxStVKX6huolXVV5ZfyZguY1lcfhVVZstce3bqxH9mcLzNn3/mlgW6wQ732+0fuG9v7h0ZQoKg==", "dev": true, "requires": { - "acorn": "^5.5.0", - "acorn-jsx": "^3.0.0" + "acorn": "^5.6.0", + "acorn-jsx": "^4.1.1" } }, "esprima": { @@ -2621,14 +2817,25 @@ } }, "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } } }, "extglob": { @@ -2664,7 +2871,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", - "dev": true + "dev": true, + "optional": true }, "fast-json-stable-stringify": { "version": "2.0.0", @@ -2966,12 +3174,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2986,17 +3196,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3113,7 +3326,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3125,6 +3339,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3139,6 +3354,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3146,12 +3362,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -3170,6 +3388,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3250,7 +3469,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3262,6 +3482,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3383,6 +3604,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3560,6 +3782,15 @@ "har-schema": "^2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -3716,6 +3947,12 @@ "os-tmpdir": "^1.0.1" } }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, "http-errors": { "version": "1.6.3", "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", @@ -3779,9 +4016,9 @@ "dev": true }, "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "imurmurhash": { @@ -3813,22 +4050,21 @@ "dev": true }, "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^2.0.4", + "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rx-lite": "^4.0.8", - "rx-lite-aggregates": "^4.0.8", + "rxjs": "^6.1.0", "string-width": "^2.1.0", "strip-ansi": "^4.0.0", "through": "^2.3.6" @@ -3870,9 +4106,9 @@ } }, "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { "has-flag": "^3.0.0" @@ -3898,6 +4134,12 @@ "kind-of": "^3.0.2" } }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", @@ -3913,6 +4155,15 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -4175,7 +4426,8 @@ "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true + "dev": true, + "optional": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -4706,6 +4958,18 @@ "type-check": "~0.3.2" } }, + "load-json-file": { + "version": "2.0.0", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, "loader-runner": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.1.tgz", @@ -5205,6 +5469,12 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, "node-libs-browser": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", @@ -5236,6 +5506,18 @@ "vm-browserify": "0.0.4" } }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, "normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", @@ -5517,6 +5799,15 @@ "is-glob": "^2.0.0" } }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, "parseqs": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", @@ -5577,6 +5868,27 @@ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -5705,9 +6017,9 @@ "dev": true }, "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", + "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", "dev": true }, "promise-inflight": { @@ -5865,6 +6177,27 @@ "unpipe": "1.0.0" } }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -5936,9 +6269,9 @@ } }, "regexpp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", - "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, "regexpu-core": { @@ -6057,6 +6390,15 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, "resolve-from": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", @@ -6128,19 +6470,13 @@ "aproba": "^1.1.1" } }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "rxjs": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", "dev": true, "requires": { - "rx-lite": "*" + "tslib": "^1.9.0" } }, "safe-buffer": { @@ -6545,6 +6881,38 @@ "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, + "spdx-correct": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", + "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz", + "integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==", + "dev": true + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -6727,6 +7095,12 @@ "ansi-regex": "^2.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -6740,47 +7114,40 @@ "dev": true }, "table": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", - "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", "dev": true, "requires": { - "ajv": "^5.2.3", - "ajv-keywords": "^2.1.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "^6.5.3", + "lodash": "^4.17.10", "slice-ansi": "1.0.0", "string-width": "^2.1.1" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true } } }, @@ -6805,7 +7172,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -7246,6 +7613,16 @@ "user-home": "^1.1.1" } }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/package.json b/package.json index 34cf6a0f..fdd6ab39 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,9 @@ "devDependencies": { "babel-cli": "^6.26.0", "babel-preset-env": "^1.7.0", - "eslint": "^4.19.1", + "eslint": "^5.7.0", + "eslint-config-metarhia": "^5.0.0", + "eslint-plugin-import": "^2.14.0", "metaschema": "^0.0.7", "metatests": "^0.2.1" } diff --git a/test/adapters.js b/test/adapters.js index 2d4b0535..24f7c011 100644 --- a/test/adapters.js +++ b/test/adapters.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('callbackify: Promise to callback-last', (test) => { +metatests.test('callbackify: Promise to callback-last', test => { const promise = Promise.resolve('result'); const callback = metasync.callbackify(promise); @@ -18,7 +18,7 @@ metatests.test('callbackify: Promise to callback-last', (test) => { }); -metatests.test('callbackify: sync function to callback-last', (test) => { +metatests.test('callbackify: sync function to callback-last', test => { const source = par => par; const callback = metasync.callbackify(source); @@ -33,7 +33,7 @@ metatests.test('callbackify: sync function to callback-last', (test) => { }); -metatests.test('promisify: callback-last to Promise', (test) => { +metatests.test('promisify: callback-last to Promise', test => { const id = 100; const data = { key: 'value' }; @@ -53,7 +53,7 @@ metatests.test('promisify: callback-last to Promise', (test) => { }); -metatests.test('promisify: callback-last to Promise throw', (test) => { +metatests.test('promisify: callback-last to Promise throw', test => { const id = 100; @@ -73,12 +73,12 @@ metatests.test('promisify: callback-last to Promise throw', (test) => { }); -metatests.test('promisify: sync function to Promise', (test) => { +metatests.test('promisify: sync function to Promise', test => { const id = 100; const data = { key: 'value' }; - const getDataSync = (dataId) => { + const getDataSync = dataId => { test.strictSame(dataId, id); return data; }; @@ -93,11 +93,11 @@ metatests.test('promisify: sync function to Promise', (test) => { }); -metatests.test('promisify: sync to Promise throw', (test) => { +metatests.test('promisify: sync to Promise throw', test => { const id = 100; - const getDataSync = (dataId) => { + const getDataSync = dataId => { test.strictSame(dataId, id); return new Error('Data not found'); }; diff --git a/test/array.each.js b/test/array.each.js index 2c597824..f03b5687 100644 --- a/test/array.each.js +++ b/test/array.each.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('successful each', (test) => { +metatests.test('successful each', test => { const arr = [1, 2, 3, 4]; const elementsSet = new Set(); @@ -12,14 +12,14 @@ metatests.test('successful each', (test) => { metasync.each(arr, (el, callback) => process.nextTick(() => { elementsSet.add(el); callback(null); - }), (err) => { + }), err => { test.error(err); test.strictSame(elementsSet, expectedElementsSet); test.end(); }); }); -metatests.test('each with empty array', (test) => { +metatests.test('each with empty array', test => { const arr = []; const elementsSet = new Set(); @@ -28,14 +28,14 @@ metatests.test('each with empty array', (test) => { metasync.each(arr, (el, callback) => process.nextTick(() => { elementsSet.add(el); callback(null); - }), (err) => { + }), err => { test.error(err); test.strictSame(elementsSet, expectedElementsSet); test.end(); }); }); -metatests.test('each with error', (test) => { +metatests.test('each with error', test => { const arr = [1, 2, 3, 4]; let count = 0; @@ -51,7 +51,7 @@ metatests.test('each with error', (test) => { } else { callback(null); } - }), (err) => { + }), err => { test.strictSame(err, eachError); test.strictSame(elementsSet.size, expectedElementsCount); test.end(); diff --git a/test/array.every.js b/test/array.every.js index c316c492..5cd05724 100644 --- a/test/array.every.js +++ b/test/array.every.js @@ -44,17 +44,17 @@ metatests.test('every with empty array', test => ( strictSameResult([], true, test, () => test.end()) )); -metatests.test('every with one-element arrays', test => - fewStrictSameResult([ [[false], false], [[true], true] ], test) +metatests.test( + 'every with one-element arrays', + test => fewStrictSameResult([ [[false], false], [[true], true] ], test) ); -metatests.test('every with two-element arrays', test => - fewStrictSameResult([ - [[false, false], false], - [[false, true ], false], - [[true, false], false], - [[true, true ], true ], - ], test) +metatests.test('every with two-element arrays', test => fewStrictSameResult([ + [[false, false], false], + [[false, true ], false], + [[true, false], false], + [[true, true ], true ], +], test) ); metatests.test('every', test => { diff --git a/test/array.filter.js b/test/array.filter.js index 56e06111..30c23566 100644 --- a/test/array.filter.js +++ b/test/array.filter.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('successful filter', (test) => { +metatests.test('successful filter', test => { const arr = [ 'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', @@ -11,7 +11,7 @@ metatests.test('successful filter', (test) => { ]; const expectedArr = [ 'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'elit', 'sed', - 'do', 'ut', 'et', 'magna' + 'do', 'ut', 'et', 'magna', ]; metasync.filter(arr, (str, callback) => process.nextTick(() => ( @@ -23,7 +23,7 @@ metatests.test('successful filter', (test) => { }); }); -metatests.test('filter with empty array', (test) => { +metatests.test('filter with empty array', test => { const arr = []; const expectedArr = []; @@ -36,7 +36,7 @@ metatests.test('filter with empty array', (test) => { }); }); -metatests.test('successful filter', (test) => { +metatests.test('successful filter', test => { const arr = [ 'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', @@ -44,7 +44,7 @@ metatests.test('successful filter', (test) => { ]; const filterError = new Error('Filter error'); const expectedArr = [ - 'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'elit', 'sed', 'magna' + 'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'elit', 'sed', 'magna', ]; metasync.filter(arr, (str, callback) => process.nextTick(() => { @@ -54,6 +54,7 @@ metatests.test('successful filter', (test) => { } callback(null, str.length < 6); }), (err, res) => { + test.error(err); test.same(res.join(), expectedArr.join()); test.end(); }); diff --git a/test/array.find.js b/test/array.find.js index 65f0af9f..4857ae09 100644 --- a/test/array.find.js +++ b/test/array.find.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('find with error', (test) => { +metatests.test('find with error', test => { const data = [1, 2, 3]; const expectedErrorMessage = 'Intentional error'; const predicate = (item, callback) => process.nextTick(() => { @@ -14,14 +14,14 @@ metatests.test('find with error', (test) => { } }); - metasync.find(data, predicate, (err) => { + metasync.find(data, predicate, err => { test.type(err, 'Error', 'err must be an instance of Error'); test.strictSame(err.message, expectedErrorMessage); test.end(); }); }); -metatests.test('find', (test) => { +metatests.test('find', test => { const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; const expected = 15; const predicate = (item, callback) => process.nextTick(() => ( @@ -35,7 +35,7 @@ metatests.test('find', (test) => { }); }); -metatests.test('with empty array', (test) => { +metatests.test('with empty array', test => { metasync.find([], (el, callback) => ( process.nextTick(() => callback(null, true)) ), (err, result) => { @@ -45,7 +45,7 @@ metatests.test('with empty array', (test) => { }); }); -metatests.test('with array without element which is searching', (test) => { +metatests.test('with array without element which is searching', test => { const data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; metasync.find(data, (el, callback) => ( process.nextTick(() => callback(null, el === 20)) diff --git a/test/array.map.js b/test/array.map.js index bf95b431..94590c4c 100644 --- a/test/array.map.js +++ b/test/array.map.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('succesfull map', (test) => { +metatests.test('succesfull map', test => { const arr = [1, 2, 3]; const expectedArr = [1, 4, 9]; @@ -16,7 +16,7 @@ metatests.test('succesfull map', (test) => { }); }); -metatests.test('map with empty array', (test) => { +metatests.test('map with empty array', test => { const arr = []; const expectedArr = []; @@ -29,7 +29,7 @@ metatests.test('map with empty array', (test) => { }); }); -metatests.test('map with error', (test) => { +metatests.test('map with error', test => { const arr = [1, 2, 3]; const mapError = new Error('Map error'); let count = 0; diff --git a/test/array.reduce.js b/test/array.reduce.js index 1a7fcbb0..c38aef01 100644 --- a/test/array.reduce.js +++ b/test/array.reduce.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('successful with initial', (test) => { +metatests.test('successful with initial', test => { const arr = [1, 2, 3, 4, 5]; const initial = 10; const expectedRes = 25; @@ -17,7 +17,7 @@ metatests.test('successful with initial', (test) => { }, initial); }); -metatests.test('reduce with initial and empty array', (test) => { +metatests.test('reduce with initial and empty array', test => { const arr = []; const initial = 10; const expectedRes = 10; @@ -31,7 +31,7 @@ metatests.test('reduce with initial and empty array', (test) => { }, initial); }); -metatests.test('reduce without initial and with empty array', (test) => { +metatests.test('reduce without initial and with empty array', test => { const arr = []; const expectedError = new TypeError( 'Reduce of empty array with no initial value' @@ -46,7 +46,7 @@ metatests.test('reduce without initial and with empty array', (test) => { }); }); -metatests.test('successful without initial', (test) => { +metatests.test('successful without initial', test => { const arr = [1, 2, 3, 4, 5]; const expectedRes = 15; @@ -59,7 +59,7 @@ metatests.test('successful without initial', (test) => { }); }); -metatests.test('successful with asymetric function', (test) => { +metatests.test('successful with asymetric function', test => { const arr = '10110011'; const expectedRes = 179; @@ -72,7 +72,7 @@ metatests.test('successful with asymetric function', (test) => { }); }); -metatests.test('with error', (test) => { +metatests.test('with error', test => { const arr = '10120011'; const reduceError = new Error('Reduce error'); diff --git a/test/array.series.js b/test/array.series.js index 5c425509..106af282 100644 --- a/test/array.series.js +++ b/test/array.series.js @@ -3,21 +3,21 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('successful series', (test) => { +metatests.test('successful series', test => { const arr = [1, 2, 3, 4]; const expectedElements = arr; const elements = []; metasync.series(arr, (el, callback) => { elements.push(el); callback(null); - }, (err) => { + }, err => { test.error(err); test.strictSame(elements, expectedElements); test.end(); }); }); -metatests.test('series with error', (test) => { +metatests.test('series with error', test => { const arr = [1, 2, 3, 4]; const expectedElements = [1, 2]; const expectedElementsCount = 2; @@ -34,7 +34,7 @@ metatests.test('series with error', (test) => { } else { callback(null); } - }, (err) => { + }, err => { test.strictSame(err, seriesError); test.strictSame(elements, expectedElements); test.end(); diff --git a/test/array.some.js b/test/array.some.js index 427c8222..cf8a044e 100644 --- a/test/array.some.js +++ b/test/array.some.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('successful some', (test) => { +metatests.test('successful some', test => { const arr = [1, 2, 3]; const predicate = (x, callback) => callback(null, x % 2 === 0); @@ -14,7 +14,7 @@ metatests.test('successful some', (test) => { }); }); -metatests.test('failing some', (test) => { +metatests.test('failing some', test => { const arr = [1, 2, 3]; const predicate = (x, callback) => callback(null, x > 3); @@ -25,7 +25,7 @@ metatests.test('failing some', (test) => { }); }); -metatests.test('erroneous some', (test) => { +metatests.test('erroneous some', test => { const arr = [1, 2, 3]; const someError = new Error('Some error'); @@ -39,7 +39,7 @@ metatests.test('erroneous some', (test) => { }); }); -metatests.test('some with empty array', (test) => { +metatests.test('some with empty array', test => { const arr = []; const predicate = (x, callback) => callback(null, x > 3); diff --git a/test/chain.js b/test/chain.js index ca05e3de..46efa4ca 100644 --- a/test/chain.js +++ b/test/chain.js @@ -13,6 +13,7 @@ metatests.test('for.map', test => { .for(data) .map(fn) .fetch((error, result) => { + test.error(error); test.strictSame(result, expected); test.end(); }); diff --git a/test/collectors.js b/test/collectors.js index 7232671a..fc93bc5c 100644 --- a/test/collectors.js +++ b/test/collectors.js @@ -3,11 +3,11 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('data collector', (test) => { +metatests.test('data collector', test => { const expectedResult = { key1: 1, key2: 2, - key3: 3 + key3: 3, }; const dc = metasync @@ -24,11 +24,11 @@ metatests.test('data collector', (test) => { dc.collect('key3', null, 3); }); -metatests.test('data collector', (test) => { +metatests.test('data collector', test => { const expectedResult = { key1: 1, key2: 2, - key3: 3 + key3: 3, }; const kc = metasync @@ -45,11 +45,11 @@ metatests.test('data collector', (test) => { kc.collect('key3', null, 3); }); -metatests.test('distinct data collector', (test) => { +metatests.test('distinct data collector', test => { const expectedResult = { key1: 2, key2: 2, - key3: 3 + key3: 3, }; const dc = metasync @@ -67,11 +67,11 @@ metatests.test('distinct data collector', (test) => { dc.pick('key3', 3); }); -metatests.test('distinct key collector', (test) => { +metatests.test('distinct key collector', test => { const expectedResult = { key1: 2, key2: 2, - key3: 3 + key3: 3, }; const kc = metasync @@ -89,11 +89,11 @@ metatests.test('distinct key collector', (test) => { kc.pick('key3', 3); }); -metatests.test('data collector with repeated keys', (test) => { +metatests.test('data collector with repeated keys', test => { const dc = metasync .collect(3) .timeout(100) - .done((err) => { + .done(err => { test.assert(err); test.end(); }); @@ -103,11 +103,11 @@ metatests.test('data collector with repeated keys', (test) => { dc.collect('key2', null, 2); }); -metatests.test('key collector with repeated keys', (test) => { +metatests.test('key collector with repeated keys', test => { const kc = metasync .collect(['key1', 'key2', 'key3']) .timeout(100) - .done((err) => { + .done(err => { test.assert(err); test.end(); }); @@ -117,7 +117,7 @@ metatests.test('key collector with repeated keys', (test) => { kc.collect('key2', null, 2); }); -metatests.test('collect with error', (test) => { +metatests.test('collect with error', test => { const testErr = new Error('Test error'); const col = metasync.collect(1); col.done((err, res) => { @@ -128,7 +128,7 @@ metatests.test('collect with error', (test) => { col.fail('someKey', testErr); }); -metatests.test('collect method calling after it\'s done', (test) => { +metatests.test('collect method calling after it\'s done', test => { const col = metasync.collect(1); col.done((err, res) => { test.error(err); @@ -139,7 +139,7 @@ metatests.test('collect method calling after it\'s done', (test) => { col.pick('someKey2', 'someVal2'); }); -metatests.test('keys collector receives wrong key', (test) => { +metatests.test('keys collector receives wrong key', test => { const col = metasync.collect(['rightKey']); col.done((err, res) => { test.error(err); @@ -150,9 +150,9 @@ metatests.test('keys collector receives wrong key', (test) => { col.pick('rightKey', 'someVal'); }); -metatests.test('distinct keys collector receives wrong key', (test) => { +metatests.test('distinct keys collector receives wrong key', test => { const col = metasync.collect(['rightKey']).distinct(); - col.done((err) => { + col.done(err => { test.assert(err); test.end(); }); @@ -160,7 +160,7 @@ metatests.test('distinct keys collector receives wrong key', (test) => { col.pick('rightKey', 'someVal'); }); -metatests.test('collect with take', (test) => { +metatests.test('collect with take', test => { const col = metasync.collect(1); col.done((err, res) => { test.error(err); @@ -171,7 +171,7 @@ metatests.test('collect with take', (test) => { col.take('someKey', af, 'someVal'); }); -metatests.test('collect with timeout error', (test) => { +metatests.test('collect with timeout error', test => { const timeoutErr = new Error('Collector timeout'); const col = metasync.collect(1) .done((err, res) => { @@ -184,7 +184,7 @@ metatests.test('collect with timeout error', (test) => { col.take('someKey', af, 'someVal'); }); -metatests.test('collect with take calls bigger than expected', (test) => { +metatests.test('collect with take calls bigger than expected', test => { const col = metasync.collect(1) .done((err, res) => { test.error(err); @@ -196,10 +196,10 @@ metatests.test('collect with take calls bigger than expected', (test) => { col.take('someKey2', af, 'someVal2'); }); -metatests.test('cancel data collector', (test) => { +metatests.test('cancel data collector', test => { const dc = metasync .collect(3) - .done((err) => { + .done(err => { test.assert(err); test.end(); }); @@ -208,10 +208,10 @@ metatests.test('cancel data collector', (test) => { dc.cancel(); }); -metatests.test('cancel key collector', (test) => { +metatests.test('cancel key collector', test => { const dc = metasync .collect(['uno', 'due']) - .done((err) => { + .done(err => { test.assert(err); test.end(); }); @@ -220,13 +220,13 @@ metatests.test('cancel key collector', (test) => { dc.cancel(); }); -metatests.test('collect then success', (test) => { +metatests.test('collect then success', test => { const col = metasync.collect(1).then( - (result) => { + result => { test.assert(result); test.end(); }, - (err) => { + err => { test.error(err); test.end(); } @@ -234,13 +234,13 @@ metatests.test('collect then success', (test) => { col.pick('Key', 'value'); }); -metatests.test('collect then fail', (test) => { +metatests.test('collect then fail', test => { metasync.collect(5).timeout(10).then( - (result) => { + result => { test.error(result); test.end(); }, - (err) => { + err => { test.assert(err); test.end(); } diff --git a/test/compose.clone.js b/test/compose.clone.js index 37a35f7f..17808f56 100644 --- a/test/compose.clone.js +++ b/test/compose.clone.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('async functions composition clone', (test) => { +metatests.test('async functions composition clone', test => { const data = { test: 'data' }; const expectedData = { test: 'data', data1: 'data 1', data2: 'data 2' }; diff --git a/test/compose.js b/test/compose.js index afe8f571..714fbf34 100644 --- a/test/compose.js +++ b/test/compose.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('async parallel functions composition', (test) => { +metatests.test('async parallel functions composition', test => { const data = { test: 'data' }; const expectedData = { test: 'data', data1: 'data 1', data2: 'data 2' }; @@ -28,7 +28,7 @@ metatests.test('async parallel functions composition', (test) => { }); }); -metatests.test('async complex functions composition', (test) => { +metatests.test('async complex functions composition', test => { const data = { test: 'data' }; const expectedDataInFn1 = { test: 'data' }; @@ -86,7 +86,7 @@ metatests.test('async complex functions composition', (test) => { }); const AC1 = 'async functions composition cancel before start'; -metatests.test(AC1, (test) => { +metatests.test(AC1, test => { let count = 0; @@ -113,6 +113,7 @@ metatests.test(AC1, (test) => { const fc = metasync([fn1, [[fn2, fn3]], fn4]); fc.cancel(); fc({}, (err, data) => { + test.isError(err); test.strictSame(data, undefined); test.strictSame(count, 0); test.end(); @@ -121,7 +122,7 @@ metatests.test(AC1, (test) => { }); const AC2 = 'async functions composition cancel in the middle'; -metatests.test(AC2, (test) => { +metatests.test(AC2, test => { let count = 0; let finished = 0; @@ -160,6 +161,7 @@ metatests.test(AC2, (test) => { const fc = metasync([fn1, [[fn2, fn3]], fn4]); fc({}, (err, data) => { + test.isError(err); test.strictSame(data, undefined); test.strictSame(count, 3); test.strictSame(finished, 1); @@ -172,7 +174,7 @@ metatests.test(AC2, (test) => { }); -metatests.test('async functions composition cancel after end', (test) => { +metatests.test('async functions composition cancel after end', test => { let count = 0; @@ -206,11 +208,12 @@ metatests.test('async functions composition cancel after end', (test) => { const fc = metasync([fn1, [[fn2, fn3]], fn4]); fc({}, (err, data) => { + test.error(err); test.strictSame(data, { data1: 'data 1', data2: 'data 2', data3: 'data 3', - data4: 'data 4' + data4: 'data 4', }); test.strictSame(count, 4); test.end(); @@ -222,7 +225,7 @@ metatests.test('async functions composition cancel after end', (test) => { }); -metatests.test('async functions composition to array', (test) => { +metatests.test('async functions composition to array', test => { let count = 0; @@ -248,6 +251,7 @@ metatests.test('async functions composition to array', (test) => { const fc = metasync([fn1, [[fn2, fn3]], fn4]); fc(['data 0'], (err, data) => { + test.error(err); test.strictSame(data, ['data 0', 'data 1', 'data 2', 'data 3', 'data 4']); test.strictSame(count, 4); test.end(); diff --git a/test/compose.then.js b/test/compose.then.js index dbfbe098..b15d29af 100644 --- a/test/compose.then.js +++ b/test/compose.then.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('successful then', (test) => { +metatests.test('successful then', test => { let finishedFuncsCount = 0; const res1 = 'res1'; const af1 = (data, callback) => process.nextTick(() => { @@ -36,7 +36,7 @@ metatests.test('successful then', (test) => { callback(null, { res4 }); }); const faf1 = metasync([af1, [[af2, af3]], af4]); - faf1().then((res) => { + faf1().then(res => { test.strictSame(res, { res1: 'res1', res2: 'res2', @@ -45,7 +45,7 @@ metatests.test('successful then', (test) => { }); test.strictSame(finishedFuncsCount, 4); test.end(); - }, (err) => { + }, err => { test.error(err); }); }); diff --git a/test/control.js b/test/control.js index 7f7ccc25..f954eacb 100644 --- a/test/control.js +++ b/test/control.js @@ -3,18 +3,18 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('firstOf', (test) => { +metatests.test('firstOf', test => { const returningFnIndex = 2; let dataReturned = false; - const execUnlessDataReturned = (data) => (callback) => { + const execUnlessDataReturned = data => callback => { if (dataReturned) { callback(null, data); } else { process.nextTick(execUnlessDataReturned); } }; - const makeIFn = (i) => (callback) => process.nextTick(() => { + const makeIFn = i => callback => process.nextTick(() => { const iData = 'data' + i; if (i === returningFnIndex) { dataReturned = true; @@ -35,7 +35,7 @@ metatests.test('firstOf', (test) => { }); }); -metatests.test('parallel with error', (test) => { +metatests.test('parallel with error', test => { const parallelError = new Error('Parallel error'); const fn1 = (data, cb) => { @@ -57,7 +57,7 @@ metatests.test('parallel with error', (test) => { }); }); -metatests.test('sequential with error', (test) => { +metatests.test('sequential with error', test => { const sequentialError = new Error('Sequential error'); const expectedDataInFn2 = { data1: 'data 1' }; diff --git a/test/do.js b/test/do.js index 1c904f6a..91d7568c 100644 --- a/test/do.js +++ b/test/do.js @@ -3,14 +3,11 @@ const metasync = require('..'); const metatests = require('metatests'); -const wrapAsync = ( - // Emulate Asynchronous calls - callback // function -) => { +const wrapAsync = callback => { setTimeout(callback, Math.floor((Math.random() * 500))); }; -metatests.test('simple chain/do', (test) => { +metatests.test('simple chain/do', test => { const readConfig = (name, callback) => { test.strictSame(name, 'myConfig'); wrapAsync(() => { diff --git a/test/firstOf.js b/test/firstOf.js index 5750bc31..d8a6f5b9 100644 --- a/test/firstOf.js +++ b/test/firstOf.js @@ -3,18 +3,18 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('firstOf', (test) => { +metatests.test('firstOf', test => { const returningFnIndex = 2; let dataReturned = false; - const execUnlessDataReturned = (data) => (callback) => { + const execUnlessDataReturned = data => callback => { if (dataReturned) { callback(null, data); } else { process.nextTick(execUnlessDataReturned); } }; - const makeIFn = (i) => (callback) => process.nextTick(() => { + const makeIFn = i => callback => process.nextTick(() => { const iData = 'data' + i; if (i === returningFnIndex) { dataReturned = true; diff --git a/test/fp.ap.js b/test/fp.ap.js index df9a093a..a4a6d2e8 100644 --- a/test/fp.ap.js +++ b/test/fp.ap.js @@ -3,18 +3,18 @@ const metasync = require('..'); const metatests = require('metatests'); -const asyncArgs = (callback) => ( +const asyncArgs = callback => ( process.nextTick(() => callback(null, 4, 5)) ); -const functionInCallback = (callback) => ( +const functionInCallback = callback => ( process.nextTick(() => callback(null, (x, y) => (x + y))) ); const asyncError = new Error('Async error'); -const asyncErrorCb = (callback) => ( +const asyncErrorCb = callback => ( process.nextTick(() => callback(asyncError)) ); -metatests.test('two successful functions', (test) => { +metatests.test('two successful functions', test => { metasync.ap(asyncArgs, functionInCallback)((err, res) => { test.error(err); test.strictSame(res, 9); @@ -22,7 +22,7 @@ metatests.test('two successful functions', (test) => { }); }); -metatests.test('first function with error', (test) => { +metatests.test('first function with error', test => { metasync.ap(asyncErrorCb, functionInCallback)((err, res) => { test.strictSame(err, asyncError); test.strictSame(res, undefined); @@ -30,7 +30,7 @@ metatests.test('first function with error', (test) => { }); }); -metatests.test('second function with error', (test) => { +metatests.test('second function with error', test => { metasync.ap(asyncArgs, asyncErrorCb)((err, res) => { test.strictSame(err, asyncError); test.strictSame(res, undefined); diff --git a/test/fp.asAsync.js b/test/fp.asAsync.js index 92805cab..d3a5f552 100644 --- a/test/fp.asAsync.js +++ b/test/fp.asAsync.js @@ -6,14 +6,14 @@ const metatests = require('metatests'); const asyncSum = (x, y, callback) => ( process.nextTick(() => callback(null, x + y)) ); -const tripleFnInCb = (callback) => ( +const tripleFnInCb = callback => ( process.nextTick(() => callback(null, x => (x * 3))) ); const asyncMultBy11 = (x, callback) => ( process.nextTick(() => callback(null, x * 11)) ); -metatests.test('asAsync all functions test', (test) => { +metatests.test('asAsync all functions test', test => { metasync.asAsync(asyncSum, 3, 5) .fmap(x => (x * 7)) .ap(tripleFnInCb) diff --git a/test/fp.concat.js b/test/fp.concat.js index 279b1014..603eaad6 100644 --- a/test/fp.concat.js +++ b/test/fp.concat.js @@ -4,21 +4,21 @@ const metasync = require('..'); const metatests = require('metatests'); const asyncData = 'data'; -const asyncDataCb = (callback) => ( +const asyncDataCb = callback => ( process.nextTick(() => callback(null, asyncData)) ); const asyncTwice = (str, callback) => ( process.nextTick(() => callback(null, str + str)) ); const asyncError = new Error('Async error'); -const asyncErrorCb = (callback) => ( +const asyncErrorCb = callback => ( process.nextTick(() => callback(asyncError)) ); const asyncTransformErrorCb = (str, callback) => ( process.nextTick(() => callback(asyncError)) ); -metatests.test('two successful functions', (test) => { +metatests.test('two successful functions', test => { metasync.concat(asyncDataCb, asyncTwice)((err, res) => { test.error(err); test.strictSame(res, 'datadata'); @@ -26,7 +26,7 @@ metatests.test('two successful functions', (test) => { }); }); -metatests.test('first function error', (test) => { +metatests.test('first function error', test => { metasync.concat(asyncErrorCb, asyncTwice)((err, res) => { test.strictSame(err, asyncError); test.strictSame(res, undefined); @@ -34,7 +34,7 @@ metatests.test('first function error', (test) => { }); }); -metatests.test('second function error', (test) => { +metatests.test('second function error', test => { metasync.concat(asyncDataCb, asyncTransformErrorCb)((err, res) => { test.strictSame(err, asyncError); test.strictSame(res, undefined); diff --git a/test/fp.fmap.js b/test/fp.fmap.js index 1fd7e1c6..df188791 100644 --- a/test/fp.fmap.js +++ b/test/fp.fmap.js @@ -4,19 +4,19 @@ const metasync = require('..'); const metatests = require('metatests'); const asyncData = 'data'; -const asyncDataCb = (callback) => process.nextTick(() => { +const asyncDataCb = callback => process.nextTick(() => { callback(null, asyncData); }); const asyncError = new Error('Async error'); -const asyncErrorCb = (callback) => process.nextTick(() => { +const asyncErrorCb = callback => process.nextTick(() => { callback(asyncError); }); const identity = x => x; -const repeatStringTwice = (str) => (str + str); -const appendColon = (str) => (str + ':'); -const twiceAndColon = (str) => appendColon(repeatStringTwice(str)); +const repeatStringTwice = str => (str + str); +const appendColon = str => (str + ':'); +const twiceAndColon = str => appendColon(repeatStringTwice(str)); -metatests.test('Result transformation', (test) => { +metatests.test('Result transformation', test => { const expected = 'data:'; metasync.fmap(asyncDataCb, appendColon)((err, res) => { test.error(err); @@ -25,7 +25,7 @@ metatests.test('Result transformation', (test) => { }); }); -metatests.test('Getting asynchronous error', (test) => { +metatests.test('Getting asynchronous error', test => { metasync.fmap(asyncErrorCb, appendColon)((err, res) => { test.strictSame(err, asyncError); test.strictSame(res, undefined); @@ -34,9 +34,9 @@ metatests.test('Getting asynchronous error', (test) => { }); const FP1 = 'Getting error with no second argument execution'; -metatests.test(FP1, (test) => { +metatests.test(FP1, test => { let executed = false; - metasync.fmap(asyncErrorCb, (str) => { + metasync.fmap(asyncErrorCb, str => { executed = true; return appendColon(str); })(() => { @@ -45,7 +45,7 @@ metatests.test(FP1, (test) => { }); }); -metatests.test('functor law I', (test) => { +metatests.test('functor law I', test => { metasync.fmap(asyncDataCb, identity)((err, res) => { test.error(err); test.strictSame(asyncData, res); @@ -53,7 +53,7 @@ metatests.test('functor law I', (test) => { }); }); -metatests.test('functor law II', (test) => { +metatests.test('functor law II', test => { const fmap = metasync.fmap; const asyncTwice = fmap(asyncDataCb, repeatStringTwice); const asyncTwiceAndColon = fmap(asyncTwice, appendColon); diff --git a/test/fp.of.js b/test/fp.of.js index 3ce35622..ecce9aa6 100644 --- a/test/fp.of.js +++ b/test/fp.of.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('of test', (test) => { +metatests.test('of test', test => { const args = [1, 2, 3, 4, 5]; metasync.of(...args)((err, ...argsCb) => { test.error(err); diff --git a/test/memoize.js b/test/memoize.js index ece4ce48..84d7eb0e 100644 --- a/test/memoize.js +++ b/test/memoize.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('memoize', (test) => { +metatests.test('memoize', test => { const storage = { file1: Buffer.from('file1'), file2: Buffer.from('file2'), @@ -20,7 +20,7 @@ metatests.test('memoize', (test) => { const memoizedGetData = metasync.memoize(getData); const keys = []; - memoizedGetData.on('memoize', (key) => { + memoizedGetData.on('memoize', key => { keys.push(key); }); @@ -44,7 +44,7 @@ metatests.test('memoize', (test) => { }); }); -metatests.test('memoize clear cache', (test) => { +metatests.test('memoize clear cache', test => { const storage = { file1: Buffer.from('file1'), }; @@ -78,7 +78,7 @@ metatests.test('memoize clear cache', (test) => { }); }); -metatests.test('memoize cache del', (test) => { +metatests.test('memoize cache del', test => { const storage = { file1: Buffer.from('file1'), }; @@ -112,7 +112,7 @@ metatests.test('memoize cache del', (test) => { }); }); -metatests.test('memoize cache add', (test) => { +metatests.test('memoize cache add', test => { const getData = (file, callback) => { process.nextTick(() => { const result = Buffer.from('added'); @@ -137,7 +137,7 @@ metatests.test('memoize cache add', (test) => { }); }); -metatests.test('memoize cache get', (test) => { +metatests.test('memoize cache get', test => { const getData = (file, callback) => { process.nextTick(() => { const result = Buffer.from('added'); diff --git a/test/poolify.js b/test/poolify.js index 1c08c592..4304a011 100644 --- a/test/poolify.js +++ b/test/poolify.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('poolify simple', (test) => { +metatests.test('poolify simple', test => { const buffer = () => new Uint32Array(128); @@ -24,7 +24,7 @@ metatests.test('poolify simple', (test) => { }); -metatests.test('poolify loop', (test) => { +metatests.test('poolify loop', test => { const buffer = () => new Uint32Array(128); @@ -42,7 +42,7 @@ metatests.test('poolify loop', (test) => { }); -metatests.test('poolify max', (test) => { +metatests.test('poolify max', test => { const buffer = () => new Uint32Array(128); @@ -61,7 +61,7 @@ metatests.test('poolify max', (test) => { }); -metatests.test('poolify delayed order', (test) => { +metatests.test('poolify delayed order', test => { const buffer = () => new Uint32Array(128); @@ -91,7 +91,7 @@ metatests.test('poolify delayed order', (test) => { }); -metatests.test('poolify functor', (test) => { +metatests.test('poolify functor', test => { const adder = a => b => adder(a + b); @@ -110,7 +110,7 @@ metatests.test('poolify functor', (test) => { }); -metatests.test('poolify get sync', (test) => { +metatests.test('poolify get sync', test => { const adder = a => b => adder(a + b); diff --git a/test/queue.js b/test/queue.js index 8d539f5c..555ee01d 100644 --- a/test/queue.js +++ b/test/queue.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('queue add', (test) => { +metatests.test('queue add', test => { const queue = metasync.queue(3).timeout(2000); let taskIndex = 1; @@ -25,7 +25,7 @@ metatests.test('queue add', (test) => { } }); -metatests.test('queue pause resume clear', (test) => { +metatests.test('queue pause resume clear', test => { const queue = metasync.queue(3); queue.pause(); queue.add({ id: 1 }); @@ -48,7 +48,7 @@ metatests.test('queue pause resume clear', (test) => { test.end(); }); -metatests.test('queue with no process function and no timeout', (test) => { +metatests.test('queue with no process function and no timeout', test => { const queue = metasync.queue(3); queue.add({ id: 1 }); queue.add({ id: 2 }); @@ -58,7 +58,7 @@ metatests.test('queue with no process function and no timeout', (test) => { test.end(); }); -metatests.test('queue with timeout event', (test) => { +metatests.test('queue with timeout event', test => { const timeoutErr = new Error('Queue timed out'); const queue = metasync.queue(3); diff --git a/test/queue.modes.js b/test/queue.modes.js index dd9ae544..9233ea90 100644 --- a/test/queue.modes.js +++ b/test/queue.modes.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('queue default FIFO', (test) => { +metatests.test('queue default FIFO', test => { const queue = metasync.queue(3).timeout(1); const res = []; @@ -24,7 +24,7 @@ metatests.test('queue default FIFO', (test) => { } }); -metatests.test('queue FIFO', (test) => { +metatests.test('queue FIFO', test => { const queue = metasync.queue(3).fifo().timeout(1); const res = []; @@ -45,7 +45,7 @@ metatests.test('queue FIFO', (test) => { } }); -metatests.test('queue LIFO', (test) => { +metatests.test('queue LIFO', test => { const queue = metasync.queue(3).lifo().timeout(1); const res = []; @@ -66,7 +66,7 @@ metatests.test('queue LIFO', (test) => { } }); -metatests.test('queue priority', (test) => { +metatests.test('queue priority', test => { const queue = metasync.queue(3).priority(); const res = []; @@ -93,7 +93,7 @@ metatests.test('queue priority', (test) => { queue.add({ id: 9 }, 3); }); -metatests.test('queue round robin', (test) => { +metatests.test('queue round robin', test => { const queue = metasync.queue(3).roundRobin(); const res = []; @@ -120,7 +120,7 @@ metatests.test('queue round robin', (test) => { queue.add({ id: 9 }, 2); }); -metatests.test('queue round robin with priority', (test) => { +metatests.test('queue round robin with priority', test => { const queue = metasync.queue(3).roundRobin().priority(); const res = []; diff --git a/test/throttle.js b/test/throttle.js index 4109fda0..a1f02e32 100644 --- a/test/throttle.js +++ b/test/throttle.js @@ -3,7 +3,7 @@ const metasync = require('..'); const metatests = require('metatests'); -metatests.test('throttle', (test) => { +metatests.test('throttle', test => { let callCount = 0; const fn = (arg1, arg2, ...otherArgs) => { @@ -25,7 +25,7 @@ metatests.test('throttle', (test) => { test.strictSame(callCount, 1); }); -metatests.test('throttle merge args', (test) => { +metatests.test('throttle merge args', test => { let callCount = 0; const fn = (arg1, arg2, ...otherArgs) => { @@ -47,7 +47,7 @@ metatests.test('throttle merge args', (test) => { test.strictSame(callCount, 1); }); -metatests.test('throttle without arguments for function', (test) => { +metatests.test('throttle without arguments for function', test => { let callCount = 0; const fn = (...args) => { @@ -67,7 +67,7 @@ metatests.test('throttle without arguments for function', (test) => { test.strictSame(callCount, 1); }); -metatests.test('debounce', (test) => { +metatests.test('debounce', test => { let count = 0; const fn = (arg1, arg2, ...otherArgs) => { @@ -85,7 +85,7 @@ metatests.test('debounce', (test) => { test.strictSame(count, 0); }); -metatests.test('debounce without arguments for function', (test) => { +metatests.test('debounce without arguments for function', test => { let count = 0; const fn = (...args) => { @@ -101,8 +101,8 @@ metatests.test('debounce without arguments for function', (test) => { test.strictSame(count, 0); }); -metatests.test('timeout with sync function', (test) => { - const syncFn = (callback) => callback(null, 'someVal'); +metatests.test('timeout with sync function', test => { + const syncFn = callback => callback(null, 'someVal'); metasync.timeout(1, syncFn, (err, res, ...args) => { test.error(err); test.strictSame(res, 'someVal'); @@ -111,8 +111,8 @@ metatests.test('timeout with sync function', (test) => { }); }); -metatests.test('timeout', (test) => { - metasync.timeout(10, (callback) => { +metatests.test('timeout', test => { + metasync.timeout(10, callback => { setTimeout(() => { callback(null, 'someVal'); }, 0); diff --git a/tests/all.js b/tests/all.js index 087deaff..5281dd70 100644 --- a/tests/all.js +++ b/tests/all.js @@ -6,7 +6,7 @@ const tests = [ 'composition.parallel', 'composition.sequential', 'composition.cancel', - 'collector' + 'collector', ]; tests diff --git a/tests/collector.js b/tests/collector.js index ce35081c..2085358d 100644 --- a/tests/collector.js +++ b/tests/collector.js @@ -7,6 +7,7 @@ const dc = metasync .collect(3) .timeout(5000) .done((error, result) => { + assert.ifError(error); assert.strictEqual(Object.keys(result).length, 3); }); @@ -18,6 +19,7 @@ const kc = metasync .collect(['key1', 'key2', 'key3']) .timeout(5000) .done((error, result) => { + assert.ifError(error); assert.strictEqual(Object.keys(result).length, 3); }); @@ -31,6 +33,7 @@ kc.pick('key3', 3); .timeout(5000) .distinct() .done((error, result) => { + assert.ifError(error); assert.strictEqual(Object.keys(result).length, 3); }); @@ -46,6 +49,7 @@ kc.pick('key3', 3); .timeout(5000) .distinct() .done((error, result) => { + assert.ifError(error); assert.strictEqual(Object.keys(result).length, 3); }); @@ -60,6 +64,7 @@ kc.pick('key3', 3); .collect(3) .timeout(5000) .done((error, result) => { + assert.ok(error); assert.strictEqual(Object.keys(result).length, 2); }); @@ -73,6 +78,7 @@ kc.pick('key3', 3); .collect(['key1', 'key2', 'key3']) .timeout(5000) .done((error, result) => { + assert.ok(error); assert.strictEqual(Object.keys(result).length, 2); }); @@ -86,6 +92,7 @@ kc.pick('key3', 3); .collect(3) .timeout(5000) .done((error, result) => { + assert.ifError(error); assert.strictEqual(Object.keys(result).length, 3); assert.strictEqual(result.key3, 3); }); diff --git a/tests/composition.cancel.js b/tests/composition.cancel.js index 7e4e6c1f..3c62c913 100644 --- a/tests/composition.cancel.js +++ b/tests/composition.cancel.js @@ -3,10 +3,7 @@ const assert = require('assert'); const metasync = require('..'); -const wrapAsync = ( - // Emulate Asynchronous calls - callback // function -) => { +const wrapAsync = callback => { setTimeout(callback, Math.floor((Math.random() * 500))); }; @@ -44,5 +41,6 @@ const fn4 = (data, cb) => { fc = metasync([fn1, fn2, fn3, fn4]); fc([], (err, data) => { + assert.ok(err); assert.equal(data, undefined); }); diff --git a/tests/composition.js b/tests/composition.js index 828b6283..56e3cc6e 100644 --- a/tests/composition.js +++ b/tests/composition.js @@ -24,6 +24,7 @@ const lookupCountry = (context, cb) => { const readFile = (context, cb) => { fs.readFile(context.file, (err, buffer) => { + assert.ifError(err); cb(null, { buffer }); }); }; @@ -31,25 +32,26 @@ const readFile = (context, cb) => { const prepareResult = (context, cb) => { const result = Object.assign({}, context.person, { country: context.country, - length: context.buffer.length + length: context.buffer.length, }); cb(null, { result }); }; const fc = metasync([ - getPerson, [[lookupCountry, readFile]], prepareResult + getPerson, [[lookupCountry, readFile]], prepareResult, ]); fc({ name: 'Mao Zedong', - file: './AUTHORS' + file: './AUTHORS', }, (err, context) => { + assert.ifError(err); const expected = { name: 'Mao Zedong', city: 'Shaoshan', born: 1893, country: 'Quin Empire', - length: 318 + length: 318, }; assert.deepEqual(context.result, expected); }); diff --git a/tests/composition.parallel.js b/tests/composition.parallel.js index 56640135..f1b80026 100644 --- a/tests/composition.parallel.js +++ b/tests/composition.parallel.js @@ -3,10 +3,7 @@ const assert = require('assert'); const metasync = require('..'); -const wrapAsync = ( - // Emulate Asynchronous calls - callback // function -) => { +const wrapAsync = callback => { setTimeout(callback, Math.floor((Math.random() * 500))); }; @@ -41,5 +38,6 @@ const fn4 = (data, cb) => { const fc = metasync([[[fn1, fn2]], fn3, fn4]); fc([], (err, data) => { + assert.ifError(err); assert.equal(data.length, 4); }); diff --git a/tests/composition.pause.js b/tests/composition.pause.js index 711f41da..403415f8 100644 --- a/tests/composition.pause.js +++ b/tests/composition.pause.js @@ -24,6 +24,7 @@ const lookupCountry = (context, cb) => { const readFile = (context, cb) => { fs.readFile(context.file, (err, buffer) => { + assert.ifError(err); cb(null, { buffer }); }); }; @@ -31,25 +32,26 @@ const readFile = (context, cb) => { const prepareResult = (context, cb) => { const result = Object.assign({}, context.person, { country: context.country, - length: context.buffer.length + length: context.buffer.length, }); cb(null, { result }); }; const fc = metasync([ - getPerson, [[lookupCountry, readFile]], prepareResult + getPerson, [[lookupCountry, readFile]], prepareResult, ]); fc({ name: 'Mao Zedong', - file: './AUTHORS' + file: './AUTHORS', }, (err, context) => { + assert.ifError(err); const expected = { name: 'Mao Zedong', city: 'Shaoshan', born: 1893, country: 'Quin Empire', - length: 318 + length: 318, }; assert.deepEqual(context.result, expected); }); diff --git a/tests/composition.sequential.js b/tests/composition.sequential.js index 6d3eb040..bb2c448f 100644 --- a/tests/composition.sequential.js +++ b/tests/composition.sequential.js @@ -11,5 +11,6 @@ const f4 = (c, cb) => cb(); const fc = metasync([f1, f2, f3, f4]); fc((err, context) => { + assert.ifError(err); assert.deepEqual(context, {}); }); diff --git a/tests/examples.js b/tests/examples.js index dfef6ffa..1b28ef72 100644 --- a/tests/examples.js +++ b/tests/examples.js @@ -21,13 +21,14 @@ if (!assert.deepStrictEqual) { // Data Collector -const dataCollectorTest = (end) => { +const dataCollectorTest = end => { const dataCollector = new metasync.DataCollector(4); dataCollector.on('done', (errs, data) => { + assert.ifError(errs); console.dir({ - dataKeys: Object.keys(data) + dataKeys: Object.keys(data), }); console.log('DataCollector test done'); end(); @@ -36,10 +37,12 @@ const dataCollectorTest = (end) => { dataCollector.collect('user', { name: 'Marcus Aurelius' }); fs.readFile('HISTORY.md', (err, data) => { + assert.ifError(err); dataCollector.collect('history', data); }); fs.readFile('README.md', (err, data) => { + assert.ifError(err); dataCollector.collect('readme', data); }); @@ -49,14 +52,14 @@ const dataCollectorTest = (end) => { }; -const dataCollectorTimeoutTest = (end) => { +const dataCollectorTimeoutTest = end => { const dataCollector = new metasync.DataCollector(4, 1000); dataCollector.on('timeout', (err, data) => { console.dir({ err: err ? err.toString() : null, - dataKeys: Object.keys(data) + dataKeys: Object.keys(data), }); console.log('Collector timeout test done'); end(); @@ -66,21 +69,21 @@ const dataCollectorTimeoutTest = (end) => { }; -const dataCollectorErrorTest = (end) => { +const dataCollectorErrorTest = end => { const dataCollector = new metasync.DataCollector(4); dataCollector.on('error', (err, key) => { console.dir({ err: err ? err.toString() : null, - key + key, }); }); dataCollector.on('done', (errs, data) => { console.dir({ errorKeys: errs ? Object.keys(errs) : null, - dataKeys: Object.keys(data) + dataKeys: Object.keys(data), }); console.log('Collector Error test done'); end(); @@ -95,13 +98,14 @@ const dataCollectorErrorTest = (end) => { // Key Collector -const keyCollectorTest = (end) => { +const keyCollectorTest = end => { const keyCollector = new metasync.KeyCollector(['user', 'history'], 1000); keyCollector.on('done', (errs, data) => { + assert.ifError(errs); console.dir({ - dataKeys: Object.keys(data) + dataKeys: Object.keys(data), }); console.log('KeyCollector test done'); end(); @@ -110,6 +114,7 @@ const keyCollectorTest = (end) => { keyCollector.collect('user', { name: 'Marcus Aurelius' }); fs.readFile('HISTORY.md', (err, data) => { + assert.ifError(err); keyCollector.collect('history', data); }); @@ -117,7 +122,7 @@ const keyCollectorTest = (end) => { // Parallel execution -const parallelTest = (end) => { +const parallelTest = end => { const pf1 = (data, callback) => { console.log('pf1'); @@ -143,7 +148,7 @@ const parallelTest = (end) => { // Sequential execution -const sequentialTest = (end) => { +const sequentialTest = end => { const sf1 = (data, callback) => { console.log('sf1'); @@ -169,7 +174,7 @@ const sequentialTest = (end) => { // Asynchrous filter -const filterTest = (end) => { +const filterTest = end => { const dataToFilter = [ 'Lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', @@ -194,6 +199,7 @@ const filterTest = (end) => { }; metasync.filter(dataToFilter, filterPredicate, (err, result) => { + assert.ifError(err); console.log('filtered array: ' + result); console.log('Filter test done'); end(); @@ -203,7 +209,7 @@ const filterTest = (end) => { // Asynchrous find -const findTest = (end) => { +const findTest = end => { metasync.find( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], @@ -211,6 +217,7 @@ const findTest = (end) => { callback(null, item % 3 === 0 && item % 5 === 0) ), (err, result) => { + assert.ifError(err); console.log('found value: ' + result); console.log('Find test done'); end(); @@ -220,7 +227,7 @@ const findTest = (end) => { }; // Asynchrous some -const someTest = (end) => { +const someTest = end => { metasync.some( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], (item, callback) => { @@ -229,6 +236,7 @@ const someTest = (end) => { callback(null, res); }, (err, result) => { + assert.ifError(err); console.log('Value ' + (result ? 'found' : 'not found')); console.log('Some test done'); end(); @@ -238,7 +246,7 @@ const someTest = (end) => { // Asyncronous each in parallel -const eachTest = (end) => { +const eachTest = end => { metasync.each( ['a', 'b', 'c'], @@ -256,7 +264,7 @@ const eachTest = (end) => { // Asyncronous series (sequential) -const seriesTest = (end) => { +const seriesTest = end => { metasync.series( //['a', 'b', 'c'], @@ -275,7 +283,7 @@ const seriesTest = (end) => { // Asyncronous reduce (sequential) -const reduceTest = (end) => { +const reduceTest = end => { metasync.reduce( ['a', 'b', 'c'], @@ -291,7 +299,7 @@ const reduceTest = (end) => { }; -const concurrentQueueTest = (end) => { +const concurrentQueueTest = end => { const queue = new metasync.ConcurrentQueue(3, 2000); @@ -321,7 +329,7 @@ const concurrentQueueTest = (end) => { queue.add({ id: 9 }); }; -const concurrentQueuePauseResumeStopTest = (end) => { +const concurrentQueuePauseResumeStopTest = end => { const queue = new metasync.ConcurrentQueue(3, 2000); queue.pause(); queue.on('empty', end); @@ -339,10 +347,10 @@ const concurrentQueuePauseResumeStopTest = (end) => { } }; -const throttleTest = (end) => { +const throttleTest = end => { let state; - const fn = (letter) => { + const fn = letter => { console.log('Throttled function, state: ' + state); if (state === letter) { console.log('Throttle test done'); @@ -384,10 +392,10 @@ const throttleTest = (end) => { }; -const debounceTest = (end) => { +const debounceTest = end => { let state; - const fn = (letter) => { + const fn = letter => { console.log('Debounced function, state: ' + state); if (state === letter) { console.log('Debounce test done'); @@ -428,7 +436,7 @@ const debounceTest = (end) => { }, 1100); }; -const mapTest = (end) => { +const mapTest = end => { metasync.map([1, 2, 3], (item, callback) => { setTimeout(() => { callback(null, item * item); @@ -455,10 +463,10 @@ const mapTest = (end) => { }); }; -const timeoutTest = (end) => { +const timeoutTest = end => { // Done function called by timer const start1 = new Date(); - metasync.timeout(200, (done) => { + metasync.timeout(200, done => { setTimeout(done, 300); }, () => { const timeDiff = new Date() - start1; @@ -476,16 +484,7 @@ const timeoutTest = (end) => { }); }; -const chainTest = (end) => { - // Just to make sure we don't forget to merge the tests. There's some bug in - // metasync.composition so part of tests, including this one, are not run. - // As a temporary workaround, you can run it via - // $ node chain-example - require('./chain-example'); - end(); -}; - -const printCallbackArgs = (end) => (err, ...args) => { +const printCallbackArgs = end => (err, ...args) => { if (err) { console.log('Error: ' + err); return; @@ -495,12 +494,12 @@ const printCallbackArgs = (end) => (err, ...args) => { end(); }; -const ofTest = (end) => { +const ofTest = end => { console.log('of test:'); metasync.monad.of(4, 'str', [1, 2, 3])(printCallbackArgs(end)); }; -const fmapTest = (end) => { +const fmapTest = end => { console.log('fmap test:'); const of = metasync.monad.of; const args = [4, 'str', [1, 2, 3]]; @@ -508,29 +507,29 @@ const fmapTest = (end) => { of(...args).fmap(reverseArgs)(printCallbackArgs(end)); }; -const monadChainTest = (end) => { +const monadChainTest = end => { console.log('Monad concat test:'); const M = metasync.monad; const args = [4, 'str', [1, 2, 3]]; - const asyncPrint = M.toAsync((args, callback) => - printCallbackArgs(callback)(null, ...args) + const asyncPrint = M.toAsync( + (args, callback) => printCallbackArgs(callback)(null, ...args) ); M.of(...args).concat(asyncPrint)(end); }; -const apTest = (end) => { +const apTest = end => { console.log('ap test:'); const M = metasync.monad; const storage = {}; const collect = (key, val) => { - if (key === undefined) return; + if (key === undefined) return null; storage[key] = val; return collect; }; const arrOfAsyncFunctions = [ - ['first', 1], ['second', 2], ['third', 3] + ['first', 1], ['second', 2], ['third', 3], ].map(args => M.of(...args)); const apR = (prev, next) => M.ap(next, prev); @@ -541,10 +540,13 @@ const apTest = (end) => { }); }; -const cbTest = (end) => { +const cbTest = end => { const fn1 = undefined; const fn2 = null; - const fn3 = (err, data) => console.log('Done callback test ' + data); + const fn3 = (err, data) => { + assert.ifError(err); + console.log('Done callback test ' + data); + }; const cb1 = metasync.cb(fn1); const cb2 = metasync.cb(fn2); @@ -584,7 +586,6 @@ metasync([ debounceTest, mapTest, timeoutTest, - chainTest, ], () => { console.log('All tests done'); }); diff --git a/tests/load/benchmark.js b/tests/load/benchmark.js index 87fd7ee1..6e4eaa3e 100644 --- a/tests/load/benchmark.js +++ b/tests/load/benchmark.js @@ -20,6 +20,9 @@ benchmark.do = (count, tests) => { const nextRepeat = () => { fn((err, res) => { + if (err) { + console.error(err); + } j++; result.push(res); if (j < count) { diff --git a/tests/load/collect.class.js b/tests/load/collect.class.js index b4962075..51fb7ddb 100644 --- a/tests/load/collect.class.js +++ b/tests/load/collect.class.js @@ -5,7 +5,7 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/collector.class.js'); -const CollectClass = (done) => { +const CollectClass = done => { const dc = metasync.collect(6); dc.done(done); let i = 0; diff --git a/tests/load/collect.functor.js b/tests/load/collect.functor.js index 3e42cd46..843293de 100644 --- a/tests/load/collect.functor.js +++ b/tests/load/collect.functor.js @@ -5,7 +5,7 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/collector.functor.js'); -const CollectFunctor = (done) => { +const CollectFunctor = done => { const dc = metasync.collect(6); dc.done(done); let i = 0; diff --git a/tests/load/collect.js b/tests/load/collect.js index 25f09557..16ff5b99 100644 --- a/tests/load/collect.js +++ b/tests/load/collect.js @@ -5,7 +5,7 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/collector.js'); -const CollectPrototype = (done) => { +const CollectPrototype = done => { const dc = metasync.collect(6); dc.done(done); let i = 0; diff --git a/tests/load/collect.prototype.js b/tests/load/collect.prototype.js index 398403cc..a87a3f0a 100644 --- a/tests/load/collect.prototype.js +++ b/tests/load/collect.prototype.js @@ -5,7 +5,7 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/collector.prototype.js'); -const CollectOldPrototype = (done) => { +const CollectOldPrototype = done => { const dc = new metasync.DataCollector(6); dc.on('done', done); let i = 0; diff --git a/tests/load/parallel.collect.js b/tests/load/parallel.collect.js index f9c769fc..1fdd89f3 100644 --- a/tests/load/parallel.collect.js +++ b/tests/load/parallel.collect.js @@ -5,7 +5,7 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); const metasync = require('../..'); -const Collect = (done) => { +const Collect = done => { const dc = metasync.collect(6); dc.done(done); let i = 0; diff --git a/tests/load/parallel.compose.js b/tests/load/parallel.compose.js index 251ca4bd..d7644dba 100644 --- a/tests/load/parallel.compose.js +++ b/tests/load/parallel.compose.js @@ -5,7 +5,7 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); const metasync = require('../..'); -const testCompose = (done) => { +const testCompose = done => { let i = 0; const p1 = (context, callback) => { setImmediate(() => callback(null, ++i * 2)); diff --git a/tests/load/parallel.promise.js b/tests/load/parallel.promise.js index e8e61dff..d7f3259c 100644 --- a/tests/load/parallel.promise.js +++ b/tests/load/parallel.promise.js @@ -4,28 +4,28 @@ const COUNT = 1000000; const benchmark = require('./benchmark.js'); -const PromiseAll = (done) => { +const PromiseAll = done => { let i = 0; - const p1 = new Promise((resolve) => { + const p1 = new Promise(resolve => { setImmediate(() => resolve({ p1: ++i * 2 })); }); - const p2 = new Promise((resolve) => { + const p2 = new Promise(resolve => { setImmediate(() => resolve({ p2: ++i * 3 })); }); - const p3 = new Promise((resolve) => { + const p3 = new Promise(resolve => { setImmediate(() => resolve({ p3: ++i * 5 })); }); - const p4 = new Promise((resolve) => { + const p4 = new Promise(resolve => { setImmediate(() => resolve({ p4: 'key ' + ++i })); }); - const p5 = new Promise((resolve) => { + const p5 = new Promise(resolve => { setImmediate(() => resolve({ p5: ++i === 5 })); }); - const p6 = new Promise((resolve) => { + const p6 = new Promise(resolve => { setImmediate(() => resolve({ p6: 'key' + ++i * 2 })); }); - Promise.all([p1, p2, p3, p4, p5, p6]).then((res) => done(null, res)); + Promise.all([p1, p2, p3, p4, p5, p6]).then(res => done(null, res)); }; benchmark.do(COUNT, [PromiseAll]); diff --git a/tests/load/poolify.array.js b/tests/load/poolify.array.js index 75c80d39..0737b1a2 100644 --- a/tests/load/poolify.array.js +++ b/tests/load/poolify.array.js @@ -6,7 +6,7 @@ const GETS = 300; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/poolify.js'); -const poolifyArray = (done) => { +const poolifyArray = done => { const buffer = () => new Uint32Array(128); const pool = metasync.poolify(buffer, 10, 100, 200); diff --git a/tests/load/poolify.opt.js b/tests/load/poolify.opt.js index c16db9e4..1ea3d9c4 100644 --- a/tests/load/poolify.opt.js +++ b/tests/load/poolify.opt.js @@ -6,7 +6,7 @@ const GETS = 300; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/poolify.opt.js'); -const poolifyNoMixin = (done) => { +const poolifyNoMixin = done => { const buffer = () => new Uint32Array(128); const pool = metasync.poolify(buffer, 10, 100, 200); diff --git a/tests/load/poolify.symbol.js b/tests/load/poolify.symbol.js index fe9b8999..2a8a6d48 100644 --- a/tests/load/poolify.symbol.js +++ b/tests/load/poolify.symbol.js @@ -6,7 +6,7 @@ const GETS = 300; const benchmark = require('./benchmark.js'); const metasync = require('../../lib/poolify.symbol.js'); -const poolifySymbol = (done) => { +const poolifySymbol = done => { const buffer = () => new Uint32Array(128); const pool = metasync.poolify(buffer, 10, 100, 200); diff --git a/tests/load/sequential.compose.js b/tests/load/sequential.compose.js index 790ce6b2..3b7ca9ef 100644 --- a/tests/load/sequential.compose.js +++ b/tests/load/sequential.compose.js @@ -5,7 +5,7 @@ const count = 100000; const benchmark = require('./benchmark.js'); const metasync = require('../..'); -const composeSequential = (done) => { +const composeSequential = done => { let i = 0; const p1 = (context, callback) => { setImmediate(() => callback(null, ++i * 2)); diff --git a/tests/load/sequential.promise.js b/tests/load/sequential.promise.js index a4c9da1a..cda53c5a 100644 --- a/tests/load/sequential.promise.js +++ b/tests/load/sequential.promise.js @@ -4,24 +4,24 @@ const count = 100000; const benchmark = require('./benchmark.js'); -const PromiseThen = (done) => { +const PromiseThen = done => { let i = 0; - const p1 = new Promise((resolve) => { + const p1 = new Promise(resolve => { setImmediate(() => resolve({ p1: ++i * 2 })); }); - const p2 = new Promise((resolve) => { + const p2 = new Promise(resolve => { setImmediate(() => resolve({ p2: ++i * 3 })); }); - const p3 = new Promise((resolve) => { + const p3 = new Promise(resolve => { setImmediate(() => resolve({ p3: ++i * 5 })); }); - const p4 = new Promise((resolve) => { + const p4 = new Promise(resolve => { setImmediate(() => resolve({ p4: 'key ' + ++i })); }); - const p5 = new Promise((resolve) => { + const p5 = new Promise(resolve => { setImmediate(() => resolve({ p5: ++i === 5 })); }); - const p6 = new Promise((resolve) => { + const p6 = new Promise(resolve => { setImmediate(() => resolve({ p6: 'key' + ++i * 2 })); }); Promise.resolve() @@ -31,7 +31,7 @@ const PromiseThen = (done) => { .then(p4) .then(p5) .then(p6) - .then((res) => done(null, res)) + .then(res => done(null, res)) .catch(console.error); };