mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 14:03:33 +09:00
Moved ai css generation to nesting rules and removed a bunch of utilities. Tested locally
14 lines
336 B
TypeScript
14 lines
336 B
TypeScript
type Predicate<Item> = (value: Item) => boolean;
|
|
|
|
export const removeByMutable = <Item>(
|
|
array: Item[],
|
|
predicate: Predicate<Item>
|
|
) => {
|
|
// reversed order to splice without breaking index
|
|
for (let index = array.length - 1; index >= 0; index -= 1) {
|
|
if (predicate(array[index])) {
|
|
array.splice(index, 1);
|
|
}
|
|
}
|
|
};
|