made with requirebin
Last active
August 31, 2016 03:32
-
-
Save ajhsu/b58e93ccd3442f4653b8b0f74a5fff17 to your computer and use it in GitHub Desktop.
json-object-diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shallowequal = require('shallowequal'); | |
const oldData = [{ | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.67831", | |
lon: "121.77582", | |
name: "羅東轉運站", | |
predictionTime: "11:35", | |
seq: "1", | |
stopId: "92572" | |
}, { | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.6780925341575", | |
lon: "121.773328717681", | |
name: "羅東火車站", | |
predictionTime: "未發車", | |
seq: "2", | |
stopId: "90505" | |
}]; | |
const newData = [{ | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.67831", | |
lon: "121.77582", | |
name: "羅東轉運站", | |
predictionTime: "11:35", | |
seq: "1", | |
stopId: "92572" | |
}, { | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.6780925341575", | |
lon: "121.773328717681", | |
name: "羅東火車站", | |
predictionTime: "未發車", | |
seq: "2", | |
stopId: "90505" | |
}, { | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.67863", | |
lon: "121.77061", | |
name: "電信局", | |
predictionTime: "未發車", | |
seq: "3", | |
stopId: "90402" | |
}]; | |
const diff = (o, n, lv = 1) => { | |
const notShownInOldData = (ne) => { | |
return !o.map(oe => shallowequal(oe, ne)) | |
.reduce((s, c) => s || c, false); | |
}; | |
return n.filter(notShownInOldData); | |
}; | |
console.table(diff(oldData, newData)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function(){ | |
;require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
/** | |
* lodash 3.1.2 (Custom Build) <https://lodash.com/> | |
* Build: `lodash modern modularize exports="npm" -o ./` | |
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | |
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | |
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
* Available under MIT license <https://lodash.com/license> | |
*/ | |
var getNative = require('lodash._getnative'), | |
isArguments = require('lodash.isarguments'), | |
isArray = require('lodash.isarray'); | |
/** Used to detect unsigned integer values. */ | |
var reIsUint = /^\d+$/; | |
/** Used for native method references. */ | |
var objectProto = Object.prototype; | |
/** Used to check objects for own properties. */ | |
var hasOwnProperty = objectProto.hasOwnProperty; | |
/* Native method references for those with the same name as other `lodash` methods. */ | |
var nativeKeys = getNative(Object, 'keys'); | |
/** | |
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | |
* of an array-like value. | |
*/ | |
var MAX_SAFE_INTEGER = 9007199254740991; | |
/** | |
* The base implementation of `_.property` without support for deep paths. | |
* | |
* @private | |
* @param {string} key The key of the property to get. | |
* @returns {Function} Returns the new function. | |
*/ | |
function baseProperty(key) { | |
return function(object) { | |
return object == null ? undefined : object[key]; | |
}; | |
} | |
/** | |
* Gets the "length" property value of `object`. | |
* | |
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | |
* that affects Safari on at least iOS 8.1-8.3 ARM64. | |
* | |
* @private | |
* @param {Object} object The object to query. | |
* @returns {*} Returns the "length" value. | |
*/ | |
var getLength = baseProperty('length'); | |
/** | |
* Checks if `value` is array-like. | |
* | |
* @private | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is array-like, else `false`. | |
*/ | |
function isArrayLike(value) { | |
return value != null && isLength(getLength(value)); | |
} | |
/** | |
* Checks if `value` is a valid array-like index. | |
* | |
* @private | |
* @param {*} value The value to check. | |
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. | |
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`. | |
*/ | |
function isIndex(value, length) { | |
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; | |
length = length == null ? MAX_SAFE_INTEGER : length; | |
return value > -1 && value % 1 == 0 && value < length; | |
} | |
/** | |
* Checks if `value` is a valid array-like length. | |
* | |
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | |
* | |
* @private | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | |
*/ | |
function isLength(value) { | |
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | |
} | |
/** | |
* A fallback implementation of `Object.keys` which creates an array of the | |
* own enumerable property names of `object`. | |
* | |
* @private | |
* @param {Object} object The object to query. | |
* @returns {Array} Returns the array of property names. | |
*/ | |
function shimKeys(object) { | |
var props = keysIn(object), | |
propsLength = props.length, | |
length = propsLength && object.length; | |
var allowIndexes = !!length && isLength(length) && | |
(isArray(object) || isArguments(object)); | |
var index = -1, | |
result = []; | |
while (++index < propsLength) { | |
var key = props[index]; | |
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { | |
result.push(key); | |
} | |
} | |
return result; | |
} | |
/** | |
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | |
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | |
* @example | |
* | |
* _.isObject({}); | |
* // => true | |
* | |
* _.isObject([1, 2, 3]); | |
* // => true | |
* | |
* _.isObject(1); | |
* // => false | |
*/ | |
function isObject(value) { | |
// Avoid a V8 JIT bug in Chrome 19-20. | |
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | |
var type = typeof value; | |
return !!value && (type == 'object' || type == 'function'); | |
} | |
/** | |
* Creates an array of the own enumerable property names of `object`. | |
* | |
* **Note:** Non-object values are coerced to objects. See the | |
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) | |
* for more details. | |
* | |
* @static | |
* @memberOf _ | |
* @category Object | |
* @param {Object} object The object to query. | |
* @returns {Array} Returns the array of property names. | |
* @example | |
* | |
* function Foo() { | |
* this.a = 1; | |
* this.b = 2; | |
* } | |
* | |
* Foo.prototype.c = 3; | |
* | |
* _.keys(new Foo); | |
* // => ['a', 'b'] (iteration order is not guaranteed) | |
* | |
* _.keys('hi'); | |
* // => ['0', '1'] | |
*/ | |
var keys = !nativeKeys ? shimKeys : function(object) { | |
var Ctor = object == null ? undefined : object.constructor; | |
if ((typeof Ctor == 'function' && Ctor.prototype === object) || | |
(typeof object != 'function' && isArrayLike(object))) { | |
return shimKeys(object); | |
} | |
return isObject(object) ? nativeKeys(object) : []; | |
}; | |
/** | |
* Creates an array of the own and inherited enumerable property names of `object`. | |
* | |
* **Note:** Non-object values are coerced to objects. | |
* | |
* @static | |
* @memberOf _ | |
* @category Object | |
* @param {Object} object The object to query. | |
* @returns {Array} Returns the array of property names. | |
* @example | |
* | |
* function Foo() { | |
* this.a = 1; | |
* this.b = 2; | |
* } | |
* | |
* Foo.prototype.c = 3; | |
* | |
* _.keysIn(new Foo); | |
* // => ['a', 'b', 'c'] (iteration order is not guaranteed) | |
*/ | |
function keysIn(object) { | |
if (object == null) { | |
return []; | |
} | |
if (!isObject(object)) { | |
object = Object(object); | |
} | |
var length = object.length; | |
length = (length && isLength(length) && | |
(isArray(object) || isArguments(object)) && length) || 0; | |
var Ctor = object.constructor, | |
index = -1, | |
isProto = typeof Ctor == 'function' && Ctor.prototype === object, | |
result = Array(length), | |
skipIndexes = length > 0; | |
while (++index < length) { | |
result[index] = (index + ''); | |
} | |
for (var key in object) { | |
if (!(skipIndexes && isIndex(key, length)) && | |
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { | |
result.push(key); | |
} | |
} | |
return result; | |
} | |
module.exports = keys; | |
},{"lodash._getnative":2,"lodash.isarguments":3,"lodash.isarray":4}],2:[function(require,module,exports){ | |
/** | |
* lodash 3.9.1 (Custom Build) <https://lodash.com/> | |
* Build: `lodash modern modularize exports="npm" -o ./` | |
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | |
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | |
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
* Available under MIT license <https://lodash.com/license> | |
*/ | |
/** `Object#toString` result references. */ | |
var funcTag = '[object Function]'; | |
/** Used to detect host constructors (Safari > 5). */ | |
var reIsHostCtor = /^\[object .+?Constructor\]$/; | |
/** | |
* Checks if `value` is object-like. | |
* | |
* @private | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | |
*/ | |
function isObjectLike(value) { | |
return !!value && typeof value == 'object'; | |
} | |
/** Used for native method references. */ | |
var objectProto = Object.prototype; | |
/** Used to resolve the decompiled source of functions. */ | |
var fnToString = Function.prototype.toString; | |
/** Used to check objects for own properties. */ | |
var hasOwnProperty = objectProto.hasOwnProperty; | |
/** | |
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | |
* of values. | |
*/ | |
var objToString = objectProto.toString; | |
/** Used to detect if a method is native. */ | |
var reIsNative = RegExp('^' + | |
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | |
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | |
); | |
/** | |
* Gets the native function at `key` of `object`. | |
* | |
* @private | |
* @param {Object} object The object to query. | |
* @param {string} key The key of the method to get. | |
* @returns {*} Returns the function if it's native, else `undefined`. | |
*/ | |
function getNative(object, key) { | |
var value = object == null ? undefined : object[key]; | |
return isNative(value) ? value : undefined; | |
} | |
/** | |
* Checks if `value` is classified as a `Function` object. | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | |
* @example | |
* | |
* _.isFunction(_); | |
* // => true | |
* | |
* _.isFunction(/abc/); | |
* // => false | |
*/ | |
function isFunction(value) { | |
// The use of `Object#toString` avoids issues with the `typeof` operator | |
// in older versions of Chrome and Safari which return 'function' for regexes | |
// and Safari 8 equivalents which return 'object' for typed array constructors. | |
return isObject(value) && objToString.call(value) == funcTag; | |
} | |
/** | |
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | |
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | |
* @example | |
* | |
* _.isObject({}); | |
* // => true | |
* | |
* _.isObject([1, 2, 3]); | |
* // => true | |
* | |
* _.isObject(1); | |
* // => false | |
*/ | |
function isObject(value) { | |
// Avoid a V8 JIT bug in Chrome 19-20. | |
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | |
var type = typeof value; | |
return !!value && (type == 'object' || type == 'function'); | |
} | |
/** | |
* Checks if `value` is a native function. | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a native function, else `false`. | |
* @example | |
* | |
* _.isNative(Array.prototype.push); | |
* // => true | |
* | |
* _.isNative(_); | |
* // => false | |
*/ | |
function isNative(value) { | |
if (value == null) { | |
return false; | |
} | |
if (isFunction(value)) { | |
return reIsNative.test(fnToString.call(value)); | |
} | |
return isObjectLike(value) && reIsHostCtor.test(value); | |
} | |
module.exports = getNative; | |
},{}],3:[function(require,module,exports){ | |
/** | |
* lodash (Custom Build) <https://lodash.com/> | |
* Build: `lodash modularize exports="npm" -o ./` | |
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | |
* Released under MIT license <https://lodash.com/license> | |
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | |
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
*/ | |
/** Used as references for various `Number` constants. */ | |
var MAX_SAFE_INTEGER = 9007199254740991; | |
/** `Object#toString` result references. */ | |
var argsTag = '[object Arguments]', | |
funcTag = '[object Function]', | |
genTag = '[object GeneratorFunction]'; | |
/** Used for built-in method references. */ | |
var objectProto = Object.prototype; | |
/** Used to check objects for own properties. */ | |
var hasOwnProperty = objectProto.hasOwnProperty; | |
/** | |
* Used to resolve the | |
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | |
* of values. | |
*/ | |
var objectToString = objectProto.toString; | |
/** Built-in value references. */ | |
var propertyIsEnumerable = objectProto.propertyIsEnumerable; | |
/** | |
* Checks if `value` is likely an `arguments` object. | |
* | |
* @static | |
* @memberOf _ | |
* @since 0.1.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is an `arguments` object, | |
* else `false`. | |
* @example | |
* | |
* _.isArguments(function() { return arguments; }()); | |
* // => true | |
* | |
* _.isArguments([1, 2, 3]); | |
* // => false | |
*/ | |
function isArguments(value) { | |
// Safari 8.1 makes `arguments.callee` enumerable in strict mode. | |
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && | |
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); | |
} | |
/** | |
* Checks if `value` is array-like. A value is considered array-like if it's | |
* not a function and has a `value.length` that's an integer greater than or | |
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. | |
* | |
* @static | |
* @memberOf _ | |
* @since 4.0.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is array-like, else `false`. | |
* @example | |
* | |
* _.isArrayLike([1, 2, 3]); | |
* // => true | |
* | |
* _.isArrayLike(document.body.children); | |
* // => true | |
* | |
* _.isArrayLike('abc'); | |
* // => true | |
* | |
* _.isArrayLike(_.noop); | |
* // => false | |
*/ | |
function isArrayLike(value) { | |
return value != null && isLength(value.length) && !isFunction(value); | |
} | |
/** | |
* This method is like `_.isArrayLike` except that it also checks if `value` | |
* is an object. | |
* | |
* @static | |
* @memberOf _ | |
* @since 4.0.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is an array-like object, | |
* else `false`. | |
* @example | |
* | |
* _.isArrayLikeObject([1, 2, 3]); | |
* // => true | |
* | |
* _.isArrayLikeObject(document.body.children); | |
* // => true | |
* | |
* _.isArrayLikeObject('abc'); | |
* // => false | |
* | |
* _.isArrayLikeObject(_.noop); | |
* // => false | |
*/ | |
function isArrayLikeObject(value) { | |
return isObjectLike(value) && isArrayLike(value); | |
} | |
/** | |
* Checks if `value` is classified as a `Function` object. | |
* | |
* @static | |
* @memberOf _ | |
* @since 0.1.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a function, else `false`. | |
* @example | |
* | |
* _.isFunction(_); | |
* // => true | |
* | |
* _.isFunction(/abc/); | |
* // => false | |
*/ | |
function isFunction(value) { | |
// The use of `Object#toString` avoids issues with the `typeof` operator | |
// in Safari 8-9 which returns 'object' for typed array and other constructors. | |
var tag = isObject(value) ? objectToString.call(value) : ''; | |
return tag == funcTag || tag == genTag; | |
} | |
/** | |
* Checks if `value` is a valid array-like length. | |
* | |
* **Note:** This method is loosely based on | |
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). | |
* | |
* @static | |
* @memberOf _ | |
* @since 4.0.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | |
* @example | |
* | |
* _.isLength(3); | |
* // => true | |
* | |
* _.isLength(Number.MIN_VALUE); | |
* // => false | |
* | |
* _.isLength(Infinity); | |
* // => false | |
* | |
* _.isLength('3'); | |
* // => false | |
*/ | |
function isLength(value) { | |
return typeof value == 'number' && | |
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | |
} | |
/** | |
* Checks if `value` is the | |
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | |
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | |
* | |
* @static | |
* @memberOf _ | |
* @since 0.1.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | |
* @example | |
* | |
* _.isObject({}); | |
* // => true | |
* | |
* _.isObject([1, 2, 3]); | |
* // => true | |
* | |
* _.isObject(_.noop); | |
* // => true | |
* | |
* _.isObject(null); | |
* // => false | |
*/ | |
function isObject(value) { | |
var type = typeof value; | |
return !!value && (type == 'object' || type == 'function'); | |
} | |
/** | |
* Checks if `value` is object-like. A value is object-like if it's not `null` | |
* and has a `typeof` result of "object". | |
* | |
* @static | |
* @memberOf _ | |
* @since 4.0.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | |
* @example | |
* | |
* _.isObjectLike({}); | |
* // => true | |
* | |
* _.isObjectLike([1, 2, 3]); | |
* // => true | |
* | |
* _.isObjectLike(_.noop); | |
* // => false | |
* | |
* _.isObjectLike(null); | |
* // => false | |
*/ | |
function isObjectLike(value) { | |
return !!value && typeof value == 'object'; | |
} | |
module.exports = isArguments; | |
},{}],4:[function(require,module,exports){ | |
/** | |
* lodash 3.0.4 (Custom Build) <https://lodash.com/> | |
* Build: `lodash modern modularize exports="npm" -o ./` | |
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | |
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | |
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
* Available under MIT license <https://lodash.com/license> | |
*/ | |
/** `Object#toString` result references. */ | |
var arrayTag = '[object Array]', | |
funcTag = '[object Function]'; | |
/** Used to detect host constructors (Safari > 5). */ | |
var reIsHostCtor = /^\[object .+?Constructor\]$/; | |
/** | |
* Checks if `value` is object-like. | |
* | |
* @private | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | |
*/ | |
function isObjectLike(value) { | |
return !!value && typeof value == 'object'; | |
} | |
/** Used for native method references. */ | |
var objectProto = Object.prototype; | |
/** Used to resolve the decompiled source of functions. */ | |
var fnToString = Function.prototype.toString; | |
/** Used to check objects for own properties. */ | |
var hasOwnProperty = objectProto.hasOwnProperty; | |
/** | |
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | |
* of values. | |
*/ | |
var objToString = objectProto.toString; | |
/** Used to detect if a method is native. */ | |
var reIsNative = RegExp('^' + | |
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | |
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | |
); | |
/* Native method references for those with the same name as other `lodash` methods. */ | |
var nativeIsArray = getNative(Array, 'isArray'); | |
/** | |
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | |
* of an array-like value. | |
*/ | |
var MAX_SAFE_INTEGER = 9007199254740991; | |
/** | |
* Gets the native function at `key` of `object`. | |
* | |
* @private | |
* @param {Object} object The object to query. | |
* @param {string} key The key of the method to get. | |
* @returns {*} Returns the function if it's native, else `undefined`. | |
*/ | |
function getNative(object, key) { | |
var value = object == null ? undefined : object[key]; | |
return isNative(value) ? value : undefined; | |
} | |
/** | |
* Checks if `value` is a valid array-like length. | |
* | |
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | |
* | |
* @private | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | |
*/ | |
function isLength(value) { | |
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | |
} | |
/** | |
* Checks if `value` is classified as an `Array` object. | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | |
* @example | |
* | |
* _.isArray([1, 2, 3]); | |
* // => true | |
* | |
* _.isArray(function() { return arguments; }()); | |
* // => false | |
*/ | |
var isArray = nativeIsArray || function(value) { | |
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; | |
}; | |
/** | |
* Checks if `value` is classified as a `Function` object. | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | |
* @example | |
* | |
* _.isFunction(_); | |
* // => true | |
* | |
* _.isFunction(/abc/); | |
* // => false | |
*/ | |
function isFunction(value) { | |
// The use of `Object#toString` avoids issues with the `typeof` operator | |
// in older versions of Chrome and Safari which return 'function' for regexes | |
// and Safari 8 equivalents which return 'object' for typed array constructors. | |
return isObject(value) && objToString.call(value) == funcTag; | |
} | |
/** | |
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | |
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | |
* @example | |
* | |
* _.isObject({}); | |
* // => true | |
* | |
* _.isObject([1, 2, 3]); | |
* // => true | |
* | |
* _.isObject(1); | |
* // => false | |
*/ | |
function isObject(value) { | |
// Avoid a V8 JIT bug in Chrome 19-20. | |
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | |
var type = typeof value; | |
return !!value && (type == 'object' || type == 'function'); | |
} | |
/** | |
* Checks if `value` is a native function. | |
* | |
* @static | |
* @memberOf _ | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a native function, else `false`. | |
* @example | |
* | |
* _.isNative(Array.prototype.push); | |
* // => true | |
* | |
* _.isNative(_); | |
* // => false | |
*/ | |
function isNative(value) { | |
if (value == null) { | |
return false; | |
} | |
if (isFunction(value)) { | |
return reIsNative.test(fnToString.call(value)); | |
} | |
return isObjectLike(value) && reIsHostCtor.test(value); | |
} | |
module.exports = isArray; | |
},{}],"shallowequal":[function(require,module,exports){ | |
'use strict'; | |
var fetchKeys = require('lodash.keys'); | |
module.exports = function shallowEqual(objA, objB, compare, compareContext) { | |
var ret = compare ? compare.call(compareContext, objA, objB) : void 0; | |
if (ret !== void 0) { | |
return !!ret; | |
} | |
if (objA === objB) { | |
return true; | |
} | |
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { | |
return false; | |
} | |
var keysA = fetchKeys(objA); | |
var keysB = fetchKeys(objB); | |
var len = keysA.length; | |
if (len !== keysB.length) { | |
return false; | |
} | |
compareContext = compareContext || null; | |
// Test for A's keys different from B. | |
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); | |
for (var i = 0; i < len; i++) { | |
var key = keysA[i]; | |
if (!bHasOwnProperty(key)) { | |
return false; | |
} | |
var valueA = objA[key]; | |
var valueB = objB[key]; | |
var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; | |
if (_ret === false || _ret === void 0 && valueA !== valueB) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
},{"lodash.keys":1}]},{},[]) | |
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2hvbWUvYWRtaW4vYnJvd3N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xuXG4gICAgdmFyIGxlbiA9IGtleXNBLmxlbmd0aDtcbiAgICBpZiAobGVuICE9PSBrZXlzQi5sZW5ndGgpIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIGNvbXBhcmVDb250ZXh0ID0gY29tcGFyZUNvbnRleHQgfHwgbnVsbDtcblxuICAgIC8vIFRlc3QgZm9yIEEncyBrZXlzIGRpZmZlcmVudCBmcm9tIEIuXG4gICAgdmFyIGJIYXNPd25Qcm9wZXJ0eSA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuYmluZChvYmpCKTtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7XG4gICAgICAgIHZhciBrZXkgPSBrZXlzQVtpXTtcbiAgICAgICAgaWYgKCFiSGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHZhciB2YWx1ZUEgPSBvYmpBW2tleV07XG4gICAgICAgIHZhciB2YWx1ZUIgPSBvYmpCW2tleV07XG5cbiAgICAgICAgdmFyIF9yZXQgPSBjb21wYXJlID8gY29tcGFyZS5jYWxsKGNvbXBhcmVDb250ZXh0LCB2YWx1ZUEsIHZhbHVlQiwga2V5KSA6IHZvaWQgMDtcbiAgICAgICAgaWYgKF9yZXQgPT09IGZhbHNlIHx8IF9yZXQgPT09IHZvaWQgMCAmJiB2YWx1ZUEgIT09IHZhbHVlQikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG59OyJdfQ== | |
var shallowequal = require('shallowequal'); | |
const oldData = [{ | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.67831", | |
lon: "121.77582", | |
name: "羅東轉運站", | |
predictionTime: "11:35", | |
seq: "1", | |
stopId: "92572" | |
}, { | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.6780925341575", | |
lon: "121.773328717681", | |
name: "羅東火車站", | |
predictionTime: "未發車", | |
seq: "2", | |
stopId: "90505" | |
}]; | |
const newData = [{ | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.67831", | |
lon: "121.77582", | |
name: "羅東轉運站", | |
predictionTime: "11:35", | |
seq: "1", | |
stopId: "92572" | |
}, { | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.6780925341575", | |
lon: "121.773328717681", | |
name: "羅東火車站", | |
predictionTime: "未發車", | |
seq: "2", | |
stopId: "90505" | |
}, { | |
carLow: "", | |
carNo: "", | |
isFull: "0", | |
lastInfo: "", | |
lat: "24.67863", | |
lon: "121.77061", | |
name: "電信局", | |
predictionTime: "未發車", | |
seq: "3", | |
stopId: "90402" | |
}]; | |
const diff = (o, n, lv = 1) => { | |
const notShownInOldData = (ne) => { | |
return !o.map(oe => shallowequal(oe, ne)) | |
.reduce((s, c) => s || c, false); | |
}; | |
return n.filter(notShownInOldData); | |
}; | |
console.table(diff(oldData, newData)); | |
;}, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"shallowequal": "0.2.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment