From d46dd6a4a36e14330f336b77592eca86a3a9751a Mon Sep 17 00:00:00 2001 From: tunnckoCore Date: Tue, 22 Mar 2016 03:01:32 +0200 Subject: [PATCH] use `app-base` from my master --- .codeclimate.yml | 14 +++++++------- README.md | 5 +---- index.js | 14 +++++++++----- package.json | 3 ++- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 38b907b..95aa3cc 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,7 +1,7 @@ -engines: - duplication: - enabled: true - config: - languages: - javascript: - mass_threshold: 50 \ No newline at end of file +languages: + JavaScript: true +exclude_paths: +- "dist/**/*" +- "dist/*.js" +- "dist/**/*.js" +- "dist/**.js" \ No newline at end of file diff --git a/README.md b/README.md index 714e70c..3c94f7e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ npm i async-simple-iterator --save const asyncSimpleIterator = require('async-simple-iterator') ``` -### [AsyncSimpleIterator](index.js#L51) +### [AsyncSimpleIterator](index.js#L52) > Initialize `AsyncSimpleIterator` with `options`. **Params** @@ -54,9 +54,6 @@ ctrl.map([ }) ``` -### [.wrapIterator](index.js#L129) -> Wraps `iterator` function which then can be passed to [async][] lib. You can pass returned iterator function to **every** [async][] method that you want. - **Params** * `iterator` **{Function}**: Iterator to pass to [async][] lib. diff --git a/index.js b/index.js index 11babfc..9f3820e 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,7 @@ 'use strict' var utils = require('./utils') +var AppBase = require('app-base').AppBase /** * > Initialize `AsyncSimpleIterator` with `options`. @@ -53,9 +54,12 @@ function AsyncSimpleIterator (options) { return new AsyncSimpleIterator(options) } this.defaultOptions(options) - utils.Emitter(this) + utils.Emitter.call(this, this) + AppBase.call(this) } +AppBase.extend(AsyncSimpleIterator) + /** * > Setting default options. Default `settle` option is `false`. * @@ -64,12 +68,12 @@ function AsyncSimpleIterator (options) { * @api private */ -AsyncSimpleIterator.prototype.defaultOptions = function defaultOptions (options) { +AppBase.define(AsyncSimpleIterator.prototype, 'defaultOptions', function defaultOptions (options) { options = utils.extend({settle: false}, this.options, options) options.settle = typeof options.settle === 'boolean' ? !!options.settle : false this.options = options return this -} +}) /** * > Wraps `iterator` function which then can be passed to [async][] lib. @@ -126,7 +130,7 @@ AsyncSimpleIterator.prototype.defaultOptions = function defaultOptions (options) * @api public */ -AsyncSimpleIterator.prototype.wrapIterator = function wrapIterator (iterator, options) { +AppBase.define(AsyncSimpleIterator.prototype, 'wrapIterator', function wrapIterator (iterator, options) { if (typeof iterator !== 'function') { throw new TypeError('async-simple-iterator: expect `iterator` to be function') } @@ -143,7 +147,7 @@ AsyncSimpleIterator.prototype.wrapIterator = function wrapIterator (iterator, op } return utils.iteratorFactory(this, iterator) -} +}) /** * Expose `AsyncSimpleIterator` instance diff --git a/package.json b/package.json index 0655ab1..82a59e5 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "test": "standard && node test.js" }, "dependencies": { + "app-base": "github:tunnckocore/app-base", "component-emitter": "^1.2.0", "extend-shallow": "^2.0.1", "is-typeof-error": "^1.1.0", @@ -77,4 +78,4 @@ "reflinks": true } } -} \ No newline at end of file +}