mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-03 18:48:06 +09:00
- fixed default duration - fixed repeating logic when view, add or delete transitions - prevent showing transition-behavior property when use transitions UI
22 lines
577 B
TypeScript
22 lines
577 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);
|
|
}
|
|
}
|
|
};
|
|
|
|
export const repeatUntil = <Item>(array: Item[], count: number) => {
|
|
const repeatedArray: Item[] = [];
|
|
for (let index = 0; index < count; index += 1) {
|
|
repeatedArray.push(array[index % array.length]);
|
|
}
|
|
return repeatedArray;
|
|
};
|