mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
* refactor: Remove uses of AnyDuringMigration from flyout_base.ts. * refactor: Remove uses of AnyDuringMigration from flyout_metrics_manager.ts. * refactor: Remove uses of AnyDuringMigration from variables_dynamic.ts. * refactor: Remove uses of AnyDuringMigration from procedures.ts. * refactor: Remove uses of AnyDuringMigration from generator.ts. * refactor: Remove some uses of AnyDuringMigration from menu.ts. * refactor: Remove uses of AnyDuringMigration from mutator.ts. * refactor: Remove uses of AnyDuringMigration from variables.ts. * refactor: Remove uses of AnyDuringMigration from array.ts. * refactor: Remove uses of AnyDuringMigration from aria.ts. * refactor: Remove uses of AnyDuringMigration in basic_cursor.ts. * refactor: Remove uses of AnyDuringMigration in dropdowndiv.ts. * refactor: Remove uses of AnyDuringMigration in utils.ts. * refactor: Remove uses of AnyDuringMigration from menuitem.ts. * refactor: Remove uses of AnyDuringMigration from idgenerator.ts. * refactor: Remove uses of AnyDuringMigration in block_animations.ts. * refactor: Initialize definitions and functionNames in generator.ts by default.
29 lines
654 B
TypeScript
29 lines
654 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2021 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/** @namespace Blockly.utils.array */
|
|
import * as goog from '../../closure/goog/goog.js';
|
|
goog.declareModuleId('Blockly.utils.array');
|
|
|
|
|
|
/**
|
|
* Removes the first occurrence of a particular value from an array.
|
|
*
|
|
* @param arr Array from which to remove value.
|
|
* @param value Value to remove.
|
|
* @returns True if an element was removed.
|
|
* @alias Blockly.array.removeElem
|
|
* @internal
|
|
*/
|
|
export function removeElem<T>(arr: Array<T>, value: T): boolean {
|
|
const i = arr.indexOf(value);
|
|
if (i === -1) {
|
|
return false;
|
|
}
|
|
arr.splice(i, 1);
|
|
return true;
|
|
}
|