@jsplumb/util
Advanced tools
Comparing version 5.0.0-RC44 to 5.0.0-RC45
@@ -138,2 +138,52 @@ 'use strict'; | ||
} | ||
function _areEqual(a, b) { | ||
if (a != null && b == null) { | ||
return false; | ||
} else { | ||
if ((a == null || isString(a) || isBoolean(a) || isNumber(a)) && a !== b) { | ||
return false; | ||
} else { | ||
if (Array.isArray(a)) { | ||
if (!Array.isArray(b)) { | ||
return false; | ||
} else { | ||
if (!arraysEqual(a, b)) { | ||
return false; | ||
} | ||
} | ||
} else if (isObject(a)) { | ||
if (!isObject(a)) { | ||
return false; | ||
} else { | ||
if (!objectsEqual(a, b)) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
function arraysEqual(a, b) { | ||
if (a.length !== b.length) { | ||
return false; | ||
} else { | ||
for (var i = 0; i < a.length; i++) { | ||
if (!_areEqual(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
function objectsEqual(a, b) { | ||
for (var key in a) { | ||
var va = a[key], | ||
vb = b[key]; | ||
if (!_areEqual(va, vb)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function replace(inObj, path, value) { | ||
@@ -907,2 +957,3 @@ if (inObj == null) { | ||
exports.addWithFunction = addWithFunction; | ||
exports.arraysEqual = arraysEqual; | ||
exports.clone = clone; | ||
@@ -945,2 +996,3 @@ exports.each = each; | ||
exports.normal = normal; | ||
exports.objectsEqual = objectsEqual; | ||
exports.perpendicularLineTo = perpendicularLineTo; | ||
@@ -947,0 +999,0 @@ exports.pointOnLine = pointOnLine; |
@@ -134,2 +134,52 @@ function filterList(list, value, missingIsFalse) { | ||
} | ||
function _areEqual(a, b) { | ||
if (a != null && b == null) { | ||
return false; | ||
} else { | ||
if ((a == null || isString(a) || isBoolean(a) || isNumber(a)) && a !== b) { | ||
return false; | ||
} else { | ||
if (Array.isArray(a)) { | ||
if (!Array.isArray(b)) { | ||
return false; | ||
} else { | ||
if (!arraysEqual(a, b)) { | ||
return false; | ||
} | ||
} | ||
} else if (isObject(a)) { | ||
if (!isObject(a)) { | ||
return false; | ||
} else { | ||
if (!objectsEqual(a, b)) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
function arraysEqual(a, b) { | ||
if (a.length !== b.length) { | ||
return false; | ||
} else { | ||
for (var i = 0; i < a.length; i++) { | ||
if (!_areEqual(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
function objectsEqual(a, b) { | ||
for (var key in a) { | ||
var va = a[key], | ||
vb = b[key]; | ||
if (!_areEqual(va, vb)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function replace(inObj, path, value) { | ||
@@ -896,2 +946,2 @@ if (inObj == null) { | ||
export { EventGenerator, OptimisticEventGenerator, TWO_PI, add, addToDictionary, addToList, addWithFunction, clone, each, encloses, extend, fastTrim, filterList, filterNull, findAllWithFunction, findWithFunction, forEach, fromArray, functionChain, getAllWithFunction, getFromSetWithFunction, getWithFunction, getsert, gradient, insertSorted, intersects, isAssignableFrom, isBoolean, isDate, isEmpty, isFunction, isNamedFunction, isNull, isNumber, isObject, isString, lineIntersection, lineLength, lineRectangleIntersection, log, logEnabled, map, merge, normal, perpendicularLineTo, pointOnLine, populate, quadrant, remove, removeWithFunction, replace, rotateAnchorOrientation, rotatePoint, setToArray, snapToGrid, sortHelper, subtract, suggest, theta, uuid, wrap }; | ||
export { EventGenerator, OptimisticEventGenerator, TWO_PI, add, addToDictionary, addToList, addWithFunction, arraysEqual, clone, each, encloses, extend, fastTrim, filterList, filterNull, findAllWithFunction, findWithFunction, forEach, fromArray, functionChain, getAllWithFunction, getFromSetWithFunction, getWithFunction, getsert, gradient, insertSorted, intersects, isAssignableFrom, isBoolean, isDate, isEmpty, isFunction, isNamedFunction, isNull, isNumber, isObject, isString, lineIntersection, lineLength, lineRectangleIntersection, log, logEnabled, map, merge, normal, objectsEqual, perpendicularLineTo, pointOnLine, populate, quadrant, remove, removeWithFunction, replace, rotateAnchorOrientation, rotatePoint, setToArray, snapToGrid, sortHelper, subtract, suggest, theta, uuid, wrap }; |
@@ -140,2 +140,52 @@ (function (global, factory) { | ||
} | ||
function _areEqual(a, b) { | ||
if (a != null && b == null) { | ||
return false; | ||
} else { | ||
if ((a == null || isString(a) || isBoolean(a) || isNumber(a)) && a !== b) { | ||
return false; | ||
} else { | ||
if (Array.isArray(a)) { | ||
if (!Array.isArray(b)) { | ||
return false; | ||
} else { | ||
if (!arraysEqual(a, b)) { | ||
return false; | ||
} | ||
} | ||
} else if (isObject(a)) { | ||
if (!isObject(a)) { | ||
return false; | ||
} else { | ||
if (!objectsEqual(a, b)) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
function arraysEqual(a, b) { | ||
if (a.length !== b.length) { | ||
return false; | ||
} else { | ||
for (var i = 0; i < a.length; i++) { | ||
if (!_areEqual(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
function objectsEqual(a, b) { | ||
for (var key in a) { | ||
var va = a[key], | ||
vb = b[key]; | ||
if (!_areEqual(va, vb)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function replace(inObj, path, value) { | ||
@@ -909,2 +959,3 @@ if (inObj == null) { | ||
exports.addWithFunction = addWithFunction; | ||
exports.arraysEqual = arraysEqual; | ||
exports.clone = clone; | ||
@@ -947,2 +998,3 @@ exports.each = each; | ||
exports.normal = normal; | ||
exports.objectsEqual = objectsEqual; | ||
exports.perpendicularLineTo = perpendicularLineTo; | ||
@@ -949,0 +1001,0 @@ exports.pointOnLine = pointOnLine; |
{ | ||
"name": "@jsplumb/util", | ||
"version": "5.0.0-RC44", | ||
"version": "5.0.0-RC45", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "js/jsplumb.util.cjs.js", |
@@ -43,2 +43,10 @@ /** | ||
/** | ||
* Returns whether or not the two arrays are identical, ie. they have the same length and every value is the same | ||
* @param a | ||
* @param b | ||
* @internal | ||
*/ | ||
export declare function arraysEqual(a: Array<any>, b: Array<any>): boolean; | ||
/** | ||
* Defines the bounding box for some element - its x/y location, width and height, and optionally the computed center, but | ||
@@ -511,2 +519,10 @@ * that can of course be calculated from the other values. Internally there are times when the code has this to hand so we include | ||
/** | ||
* Returns whether or not the two objects are identical, ie. there are no keys in o1 that do not exist in o2 and vice versa. | ||
* @param a | ||
* @param b | ||
* @internal | ||
*/ | ||
export declare function objectsEqual(a: Record<string, any>, b: Record<string, any>): boolean; | ||
/** | ||
* A copy of a concept from a later version of Typescript than jsPlumb can currently use. | ||
@@ -610,2 +626,3 @@ */ | ||
* @param value Value to replace the original value with. | ||
* @internal | ||
*/ | ||
@@ -612,0 +629,0 @@ export declare function replace(inObj: any, path: string, value: any): any; |
109105
3580