mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-02 07:20:38 +00:00
15 lines
366 B
TypeScript
15 lines
366 B
TypeScript
import { NodeChildren } from '../document/node/node-children';
|
|
|
|
type IterableArray = NodeChildren | any[];
|
|
|
|
export function foreachReverse(
|
|
arr: IterableArray,
|
|
action: (item: any) => void,
|
|
getter: (arr: IterableArray, index: number) => any,
|
|
context: any = {},
|
|
) {
|
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
action.call(context, getter(arr, i));
|
|
}
|
|
}
|