Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,16 @@
|
||||
export function updateItem(items: any[], setItems: any, id: string, itemAttributes: any, idProp = "id") {
|
||||
const index = items.findIndex((x) => x[idProp] === id);
|
||||
if (index !== -1) {
|
||||
setItems([...items.slice(0, index), Object.assign({}, items[index], itemAttributes), ...items.slice(index + 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
export function updateItemByIdx(items: any[], setItems: any, index: number, itemAttributes: any) {
|
||||
if (index !== -1) {
|
||||
setItems([...items.slice(0, index), Object.assign({}, items[index], itemAttributes), ...items.slice(index + 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
export function isEqual(a: any, b: any) {
|
||||
return JSON.stringify(a) === JSON.stringify(b);
|
||||
}
|
||||
Reference in new issue
Block a user