Skip to content

Commit

Permalink
use app-base from my master
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Mar 22, 2016
1 parent 0590cd3 commit d46dd6a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
14 changes: 7 additions & 7 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
engines:
duplication:
enabled: true
config:
languages:
javascript:
mass_threshold: 50
languages:
JavaScript: true
exclude_paths:
- "dist/**/*"
- "dist/*.js"
- "dist/**/*.js"
- "dist/**.js"
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'use strict'

var utils = require('./utils')
var AppBase = require('app-base').AppBase

/**
* > Initialize `AsyncSimpleIterator` with `options`.
Expand Down Expand Up @@ -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`.
*
Expand All @@ -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.
Expand Down Expand Up @@ -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')
}
Expand All @@ -143,7 +147,7 @@ AsyncSimpleIterator.prototype.wrapIterator = function wrapIterator (iterator, op
}

return utils.iteratorFactory(this, iterator)
}
})

/**
* Expose `AsyncSimpleIterator` instance
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -77,4 +78,4 @@
"reflinks": true
}
}
}
}

0 comments on commit d46dd6a

Please sign in to comment.