removed use of js Set
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import {invokeCallback, mixin} from "@/common.js";
|
import {invokeCallback, mixin} from "@/common.js";
|
||||||
import {chart, createShape, deleteShapeId, dragging, draggingShapeIds, drawShape, widget} from "@/charts/chart.js";
|
import {chart, createShape, deleteShapeId, dragging, draggingShapeIds, drawShape, widget} from "@/charts/chart.js";
|
||||||
|
import {unique} from "@/misc.js";
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -263,7 +264,8 @@ function dirtyKeys(propsA, propsB) {
|
|||||||
return propsA === null ? [] : [...Object.keys(propsA)]
|
return propsA === null ? [] : [...Object.keys(propsA)]
|
||||||
if (propsA===null)
|
if (propsA===null)
|
||||||
return [...Object.keys(propsB)]
|
return [...Object.keys(propsB)]
|
||||||
return [...(new Set(Object.keys(propsB)).union(new Set(Object.keys(propsA))))].filter((k)=> !(k in propsA) || propsA[k] !== propsB[k])
|
const keys = unique([...Object.keys(propsA), ...Object.keys(propsB)])
|
||||||
|
return keys.filter((k)=> !(k in propsA) || propsA[k] !== propsB[k])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
src/misc.js
11
src/misc.js
@@ -218,3 +218,14 @@ export function lineColor(buy, index) {
|
|||||||
return c.string()
|
return c.string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function unique(arr) {
|
||||||
|
const u = {}, a = [];
|
||||||
|
for(let i = 0, l = arr.length; i < l; ++i){
|
||||||
|
if(!u.hasOwnProperty(arr[i])) {
|
||||||
|
a.push(arr[i]);
|
||||||
|
u[arr[i]] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user