Use shared module instead of custom isNotEmpty().
This commit is contained in:
parent
bb35fc3801
commit
e3ffc8784e
@ -2,17 +2,10 @@ import forEach from 'lodash.foreach'
|
|||||||
import {BaseError} from 'make-error'
|
import {BaseError} from 'make-error'
|
||||||
import {EventEmitter} from 'events'
|
import {EventEmitter} from 'events'
|
||||||
|
|
||||||
|
import isEmpty from './is-empty'
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
function isNotEmpty (map) {
|
|
||||||
/* eslint no-unused-vars: 0*/
|
|
||||||
|
|
||||||
for (let key in map) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
const {hasOwnProperty} = Object
|
const {hasOwnProperty} = Object
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
@ -267,7 +260,7 @@ export default class Collection extends EventEmitter {
|
|||||||
forEach(['add', 'update', 'remove'], action => {
|
forEach(['add', 'update', 'remove'], action => {
|
||||||
const items = data[action]
|
const items = data[action]
|
||||||
|
|
||||||
if (isNotEmpty(items)) {
|
if (!isEmpty(items)) {
|
||||||
this.emit(action, items)
|
this.emit(action, items)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user