from http://blog.vjeux.com/2011/javascript/object-difference.html
197629
function difference(template, override) {
    var ret = {};
    for (var name in template) {
        if (name in override) {
            if (isObject(override[name])) {
                var diff = difference(template[name], override[name]);
                if (!_.isEmpty(diff)) {
                    ret[name] = diff;
                }
            } else if (!_.isEqual(template[name], override[name])) {
                ret[name] = override[name];
            }
        }
    }
    return ret;
}
1182955
function( obj ) {
  // Not plain objects:
  // - Any object or value whose internal [[Class]] property is not "[object Object]"
  // - DOM nodes
  // - window
  if (typeof obj !== "object" || obj.nodeType || (obj !== null && obj === obj.window)) {
    return false;
  }

  if (obj.constructor && !Object.prototype.hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf")) {
    return false;
  }

  // If the function hasn't returned already, we're confident that
  // |obj| is a plain object, created by {} or constructed with new Object
  return true;
}
164500
function ObjectDiff () {
  var self = this

  self.klass = ObjectDiff;
  self.klass.super_.apply(self, arguments);

  self.engine = require('objectdiff');
}
260143
function diff(a, b, shallow, isOwn) {

            if (a === b) {
                return equalObj(a);
            }

            var diffValue = {};
            var equal = true;

            for (var key in a) {
                if ((!isOwn && key in b) || (isOwn && typeof b != 'undefined' && b.hasOwnProperty(key))) {
                    if (a[key] === b[key]) {
                        diffValue[key] = equalObj(a[key]);
                    } else {
                        if (!shallow && isValidAttr(a[key], b[key])) {
                            var valueDiff = diff(a[key], b[key], shallow, isOwn);
                            if (valueDiff.changed == 'equal') {
                                diffValue[key] = equalObj(a[key]);
                            } else {
                                equal = false;
                                diffValue[key] = valueDiff;
                            }
                        } else {
                            equal = false;
                            diffValue[key] = {
                                changed: 'primitive change',
                                removed: a[key],
                                added: b[key]
                            }
                        }
                    }
                } else {
                    equal = false;
                    diffValue[key] = {
                        changed: 'removed',
                        value: a[key]
                    }
                }
            }

            for (key in b) {
                if ((!isOwn && !(key in a)) || (isOwn && typeof a != 'undefined' && !a.hasOwnProperty(key))) {
                    equal = false;
                    diffValue[key] = {
                        changed: 'added',
                        value: b[key]
                    }
                }
            }

            if (equal) {
                return equalObj(a);
            } else {
                return {
                    changed: 'object change',
                    value: diffValue
                }
            }
        }
308411
function(obj) {
    console.log(`trained in ${ obj.iterations } iterations with error: ${ obj.error }`);

    const result01 = net.run([0, 1]);
    const result00 = net.run([0, 0]);
    const result11 = net.run([1, 1]);
    const result10 = net.run([1, 0]);

    assert(result01[0] > 0.9);
    assert(result00[0] < 0.1);
    assert(result11[0] < 0.1);
    assert(result10[0] > 0.9);

    console.log('0 XOR 1: ', result01);  // 0.987
    console.log('0 XOR 0: ', result00);  // 0.058
    console.log('1 XOR 1: ', result11);  // 0.087
    console.log('1 XOR 0: ', result10);  // 0.934
  }
1365818
function (obj) {
      if (!obj) return
      diffTitle.before = opt.complement
      var title = obj.inner + ' ' + (obj.separator || opt.separator) +
        ' ' +  (obj.complement || opt.complement)
      window.document.title = title.trim()
    }
690496
function (obj) {
        if (
            !obj
            || {}.toString.call(obj) !== '[object Object]'
            || obj.nodeType
            || obj.setInterval
        ) {
            return false
        }

        var hasOwn              = {}.hasOwnProperty;
        var hasOwnConstructor   = hasOwn.call(obj, 'constructor');
        // added test for node > v6
        var hasMethodPrototyped = ( typeof(obj.constructor) != 'undefined' ) ? hasOwn.call(obj.constructor.prototype, 'isPrototypeOf') : false;


        if (
            obj.constructor && !hasOwnConstructor && !hasMethodPrototyped
        ) {
            return false
        }

        //Own properties are enumerated firstly, so to speed up,
        //if last one is own, then all properties are own.
        var key;
        return key === undefined || hasOwn.call(obj, key)
    }
947493
function(objects) {
		var ret = {};
		
		for(var i=0; i<arguments.length; i++) {
			var o = arguments[i];
			
			for(var j in o) {
				ret[j] = o[j];
			}
		}
		
		return ret;
	}
407099
function compareObjects (x, y) {
    const keysX = Object.keys(x)
    const keysY = Object.keys(y)

    // compare keys
    keysX.sort(naturalSort)
    keysY.sort(naturalSort)
    const c = compareArrays(keysX, keysY)
    if (c !== 0) {
      return c
    }

    // compare values
    for (let i = 0; i < keysX.length; i++) {
      const v = compareNatural(x[keysX[i]], y[keysY[i]])
      if (v !== 0) {
        return v
      }
    }

    return 0
  }
775187
function toWindow(key, val, exclude) {
    /* istanbul ignore if */
    if (!is_1.isBrowser())
        return;
    exclude = toArray(exclude);
    var _keys, i;
    // key/val was passed.
    if (is_1.isString(key)) {
        if (!is_1.isPlainObject(val)) {
            window[key] = val;
        }
        else {
            var obj = {};
            _keys = array_1.keys(val);
            i = _keys.length;
            while (i--) {
                if (!array_1.contains(exclude, _keys[i]))
                    obj[_keys[i]] = val[_keys[i]];
            }
            window[key] = obj;
        }
    }
    // object passed to key.
    else if (is_1.isPlainObject(key)) {
        _keys = array_1.keys(key);
        i = _keys.length;
        while (i--) {
            if (!array_1.contains(exclude, _keys[i]))
                window[_keys[i]] = key[_keys[i]];
        }
    }
}
1291454
def difference(self, *args):
        
        setobj = set(self.obj)
        for i, v in enumerate(args):
            setobj = setobj - set(args[i])
        return self._wrap(self._clean._toOriginal(setobj))
1157333
function (obj) {
			this.writeDebug('hasEmptyObjectVals',arguments);
				var objTest = true;

				for(var key in obj) {
					if (obj.hasOwnProperty(key)) {
						if (obj[key] !== '' && obj[key].length !== 0) {
							objTest = false;
						}
					}
				}

				return objTest;
		}
112660
function (obj) {
    var result = {};

    var walk = function (obj, result, path, originObj) {
        if (!originObj) {
            var originObj = obj;
        }
        if (!path) {
            path = '';
        }

        if (_.isObject(obj) && !_.isArray(obj) && !_.isRegExp(obj) && !_.isFunction(obj)) {
            for (var value in obj) {

                if (_.isObject(obj[value]) && !_.isArray(obj[value]) && !_.isFunction(obj[value]) && !_.isRegExp(obj[value]) && !_.isDate(obj[value])) {
                    var subPath = _.isEmpty(path) ? value : path + '.' + value;
                    /*var subPath;

                     if (_.isEmpty(path)) {
                     subPath = value;
                     }
                     else {
                     if (/^-?[\d.]+(?:e-?\d+)?$/.test(value)) {
                     subPath = path + '["' + value + '"]';
                     }
                     else {
                     subPath = path + '.' + value;
                     }
                     }*/
                    result = walk(obj[value], result, subPath, originObj);
                }
                else {
                    if (_.isArray(obj[value])) {

                        for (var subObj in obj[value]) {


                            if (typeof obj[value][subObj] != "object") {
                                // Check if type object array or plain array
                                if (path) {
                                    result[path + '.' + value] = obj[value];
                                }
                                else {
                                    if (!result[value]) {
                                        result[value] = [];
                                    }
                                    result[value] = obj[value];
                                }
                            }
                            else {
                                if (obj[value][subObj][0] && !_.isObject(obj[value][subObj][0])) {
                                    if (!result[value]) {
                                        result[value] = [];
                                    }
                                    result[value][subObj] = obj[value][subObj];
                                }
                                else {
                                    if (path) {
                                        // Check if is Array or Object
                                        if (!_.isArray(obj[value])) {
                                            if (!result[path]) {
                                                result[path] = {};
                                            }
                                            if (!result[path][value]) {
                                                result[path][value] = {};
                                            }
                                            result[path][value][subObj] = plainValues(obj[value][subObj]);
                                        }
                                        else {
                                            if (!result[path]) {
                                                result[path] = {};
                                            }
                                            if (!result[path][value]) {
                                                result[path][value] = [];
                                            }
                                            result[path][value].push(plainValues(obj[value][subObj]));
                                        }
                                    }
                                    else {
                                        if (!result[value]) {
                                            result[value] = [];
                                        }
                                        result[value][subObj] = plainValues(obj[value][subObj]);
                                    }
                                }
                            }
                        }


                    }
                    else {
                        var pathName = path.replace('["', '.');
                        pathName = pathName.replace('"]', '');

                        if (path == '') {
                            try {
                                result[value] = eval('originObj' + generateObjectPath(value) + '');
                            } catch (e) {
                            }
                        }
                        else {
                            try {
                                result[pathName + '.' + value] = eval('originObj' + generateObjectPath(path) + '["' + value + '"]');
                            } catch (e) {
                            }
                        }
                    }
                }
            }
        }
        return result;
    };

    var resultArray = walk(obj, result);
    return _.isEmpty(resultArray) ? false : resultArray;
}
349115
function (obj) {
			var size;
			var test = doc.createElement('span');

			test.innerHTML = '&nbsp;';
			test.style.position = 'absolute';
			test.style.lineHeight = '1em';
			test.style.fontSize = '1em';

			obj.appendChild(test);
			size = test.offsetHeight;
			obj.removeChild(test);

			return size;
		}
3122
function(object) {
            // three special objects that we want to treat differently
            if(object == null) {
                return "null";
            }
            if(object.constructor == Date) {
                return this.serialize.date.apply(this, [object]);
            }
            if(object.constructor == Array) {
                return this.serialize.array.apply(this, [object]);
            }
            var pieces = ['{'];
            this.level += 1;
            var key, keyJSON, valueJSON;
            
            var addComma = false;
            for(key in object) {
                if(object.hasOwnProperty(key)) {
                    // recursive calls need to allow for sub-classing
                    keyJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
                                                    [key, this.pretty]);
                    valueJSON = OpenLayers.Format.JSON.prototype.write.apply(this,
                                                    [object[key], this.pretty]);
                    if(keyJSON != null && valueJSON != null) {
                        if(addComma) {
                            pieces.push(',');
                        }
                        pieces.push(this.writeNewline(), this.writeIndent(),
                                    keyJSON, ':', this.writeSpace(), valueJSON);
                        addComma = true;
                    }
                }
            }
            
            this.level -= 1;
            pieces.push(this.writeNewline(), this.writeIndent(), '}');
            return pieces.join('');
        }
110282
function diffObjects(value, oldValue) {
    if ( !(value && oldValue && typeof value === 'object' && typeof oldValue === 'object')) {
      throw new TypeError('Both values for diff.object must be objects');
    }
    var changeRecords = [];
    var prop, propOldValue, propValue;

    // Goes through the old object (should be a clone) and look for things that are now gone or changed
    for (prop in oldValue) {
      propOldValue = oldValue[prop];
      propValue = value[prop];

      // Allow for the case of obj.prop = undefined (which is a new property, even if it is undefined)
      if (propValue !== undefined && !diffBasic(propValue, propOldValue)) {
        continue;
      }

      // If the property is gone it was removed
      if (! (prop in value)) {
        changeRecords.push(new ChangeRecord(value, 'delete', prop, propOldValue));
      } else if (diffBasic(propValue, propOldValue)) {
        changeRecords.push(new ChangeRecord(value, 'update', prop, propOldValue));
      }
    }

    // Goes through the old object and looks for things that are new
    for (prop in value) {
      propValue = value[prop];
      if (! (prop in oldValue)) {
        changeRecords.push(new ChangeRecord(value, 'add', prop));
      }
    }

    if (Array.isArray(value) && value.length !== oldValue.length) {
      changeRecords.push(new ChangeRecord(value, 'update', 'length', oldValue.length));
    }

    return changeRecords;
  }
243578
function(a){
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
return!("object"!=typeof a||a.nodeType||null!==a&&a===a.window)&&!(a.constructor&&!Object.prototype.hasOwnProperty.call(a.constructor.prototype,"isPrototypeOf"))}