Isolate isObject().

This commit is contained in:
Julien Fontanet 2015-10-02 12:26:54 +02:00
parent 2071a7d308
commit 73821b0f12
2 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import {BaseError} from 'make-error'
import {EventEmitter} from 'events'
import isEmpty from './is-empty'
import isObject from './is-object'
// ===================================================================
@ -139,7 +140,7 @@ export default class Collection extends EventEmitter {
const [key] = this._resolveItem(keyOrObjectWithId)
this._assertHas(key)
const value = this.get(key)
if (kindOf(value) !== 'object') {
if (!isObject(value)) {
throw new IllegalTouch(value)
}

View File

@ -0,0 +1,3 @@
export function isObject (value) {
return (value !== null) && (typeof value === 'object')
}