src/diff.js
function diffBasic(value, oldValue) {
    if (value && oldValue && typeof value === 'object' && typeof oldValue === 'object') {
      // Allow dates and Number/String objects to be compared
      var valueValue = value.valueOf();
      var oldValueValue = oldValue.valueOf();

      // Allow dates and Number/String objects to be compared
      if (typeof valueValue !== 'object' && typeof oldValueValue !== 'object') {
        return diffBasic(valueValue, oldValueValue);
      }
    }

    // If a value has changed call the callback
    if (typeof value === 'number' && typeof oldValue === 'number' && isNaN(value) && isNaN(oldValue)) {
      return false;
    } else {
      return value !== oldValue;
    }
  }
function diffBasic(value, oldValue) {
    if (value && oldValue && typeof value === 'object' && typeof oldValue === 'object') {
      // Allow dates and Number/String objects to be compared
      var valueValue = value.valueOf();
      var oldValueValue = oldValue.valueOf();

      // Allow dates and Number/String objects to be compared
      if (typeof valueValue !== 'object' && typeof oldValueValue !== 'object') {
        return diffBasic(valueValue, oldValueValue);
      }
    }

    // If a value has changed call the callback
    if (typeof value === 'number' && typeof oldValue === 'number' && isNaN(value) && isNaN(oldValue)) {
      return false;
    } else {
      return value !== oldValue;
    }
  }
function diffBasic ( value , oldValue ) { if ( value && oldValue && typeof value === 'object' && typeof oldValue === 'object' ) { // Allow dates and Number/String objects to be compared var valueValue = value . valueOf ( ) ; var oldValueValue = oldValue . valueOf ( ) ; // Allow dates and Number/String objects to be compared if ( typeof valueValue !== 'object' && typeof oldValueValue !== 'object' ) { return diffBasic ( valueValue , oldValueValue ) ; } } // If a value has changed call the callback if ( typeof value === 'number' && typeof oldValue === 'number' && isNaN ( value ) && isNaN ( oldValue ) ) { return false ; } else { return value !== oldValue ; } }
Diffs two basic types, returning true if changed or false if not
Diffs two basic types returning true if changed or false if not