From 93106777b063d4ece43196d1df886791621f8fe3 Mon Sep 17 00:00:00 2001 From: randrei12 <79661902+randrei12@users.noreply.github.com> Date: Tue, 22 Aug 2023 20:28:10 +0300 Subject: [PATCH] feat: make ordered argument optional for workspace functions (#7424) --- core/workspace.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/workspace.ts b/core/workspace.ts index 257ff08b1..2f3fe2b61 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -206,7 +206,7 @@ export class Workspace implements IASTNodeLocation { * @param ordered Sort the list if true. * @returns The top-level block objects. */ - getTopBlocks(ordered: boolean): Block[] { + getTopBlocks(ordered = false): Block[] { // Copy the topBlocks list. const blocks = new Array().concat(this.topBlocks); if (ordered && blocks.length > 1) { @@ -247,7 +247,7 @@ export class Workspace implements IASTNodeLocation { * @param ordered Sort the list if true. * @returns The blocks of the given type. */ - getBlocksByType(type: string, ordered: boolean): Block[] { + getBlocksByType(type: string, ordered = false): Block[] { if (!this.typedBlocksDB.has(type)) { return []; } @@ -307,7 +307,7 @@ export class Workspace implements IASTNodeLocation { * @returns The top-level comment objects. * @internal */ - getTopComments(ordered: boolean): WorkspaceComment[] { + getTopComments(ordered = false): WorkspaceComment[] { // Copy the topComments list. const comments = new Array().concat(this.topComments); if (ordered && comments.length > 1) { @@ -323,7 +323,7 @@ export class Workspace implements IASTNodeLocation { * @param ordered Sort the list if true. * @returns Array of blocks. */ - getAllBlocks(ordered: boolean): Block[] { + getAllBlocks(ordered = false): Block[] { let blocks: Block[]; if (ordered) { // Slow, but ordered.