Use lodash.foreach instead of native implementation.

This commit is contained in:
Julien Fontanet 2015-04-08 16:32:46 +02:00
parent 4ecfa0477d
commit ab221a465b
2 changed files with 6 additions and 5 deletions

View File

@ -22,6 +22,7 @@
],
"dependencies": {
"babel-runtime": "^5",
"lodash.foreach": "^3.0.2",
"make-error": "^0.3.0"
},
"devDependencies": {
@ -29,7 +30,6 @@
"chai": "*",
"dirty-chai": "^1.2.0",
"event-to-promise": "^0.3.2",
"lodash.foreach": "^3.0.2",
"mocha": "*",
"sinon": "^1.14.1",
"standard": "*"

View File

@ -1,5 +1,6 @@
import {EventEmitter} from 'events'
import forEach from 'lodash.foreach'
import makeError from 'make-error'
import {EventEmitter} from 'events'
export const BufferAlreadyFlushed = makeError('BufferAlreadyFlushed')
export const DuplicateItem = makeError('DuplicateItem')
@ -50,7 +51,7 @@ export default class Collection extends EventEmitter {
data[this._buffer[key]][key] = this._items[key]
}
['add', 'update', 'remove'].forEach(action => {
forEach(['add', 'update', 'remove'], action => {
const items = data[action]
if (isNotEmpty(items)) {
@ -194,11 +195,11 @@ export default class Collection extends EventEmitter {
}
clear () {
for (let key in this._items) {
forEach(this._items, key => {
delete this._items[key]
this._size--
this._touch('remove', key)
}
})
return this
}