Skip to content

Commit

Permalink
fix: get method typeof condition
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienMotte committed Feb 13, 2017
1 parent f3d4de2 commit 3ff13ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Signal from 'quark-signal'
import isEquals from 'lodash.isequal'
import isEqual from 'lodash.isequal'

/**
* State class
Expand All @@ -13,7 +13,7 @@ import isEquals from 'lodash.isequal'
*/
class State {
/**
* Creates an instance of Signal
* Creates an instance of State
*
* @constructor
*/
Expand Down Expand Up @@ -41,7 +41,7 @@ class State {
for (let i = 1, l = splittedQuery.length; i < l; i++) {
value = value[splittedQuery[i]]

if (value === undefined || value === null) {
if (typeof value === 'undefined' || value === null) {
break
}
}
Expand Down Expand Up @@ -88,7 +88,7 @@ class State {
}

if (typeof container.signals[signalId] !== 'undefined') {
if (!isEquals(oldVal, target)) {
if (!isEqual(oldVal, target)) {
container.signals[signalId].dispatch(oldVal, target)
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ class State {
*/
onChange (query, callback) {
if (typeof callback !== 'function') {
throw new TypeError('Signal.onChange() : Second argument must be a Function')
throw new TypeError('State.onChange() : Second argument must be a Function')
}

const { container, containerId, splittedQuery } = this._parseStateQuery(query)
Expand Down Expand Up @@ -144,7 +144,7 @@ class State {
*/
removeChangeCallback (query, callback) {
if (typeof callback !== 'function') {
throw new TypeError('Signal.removeChangeCallback() : Second argument must be a Function')
throw new TypeError('State.removeChangeCallback() : Second argument must be a Function')
}

const { container } = this._parseStateQuery(query)
Expand Down

0 comments on commit 3ff13ba

Please sign in to comment.