From 369e85e5d661cca5e9de86326c2245c0e2f38d5b Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Mon, 24 Jul 2023 12:50:25 +0300 Subject: [PATCH] fix(editor): return copy of array in getNodes/getConnections Improve DX for cases like removing all connections/nodes by iterating them. --- src/editor.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/editor.ts b/src/editor.ts index da52a40..5fed811 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -45,18 +45,18 @@ export class NodeEditor extends Scope> /** * Get all nodes - * @returns All nodes + * @returns Copy of array with nodes */ public getNodes() { - return this.nodes + return this.nodes.slice() } /** * Get all connections - * @returns All connections + * @returns Copy of array with onnections */ public getConnections() { - return this.connections + return this.connections.slice() } /**