UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

57 lines 2.34 kB
/** * These are a collection of functions for non-TypeScript users so that they can access some of * useful methods offered on the `Array` class in the JavaScript standard library. * * If you are a TypeScript user, you should never use these functions, and instead use the more * idiomatic object-oriented approach. * * @module */ /** * Helper function for non-TypeScript users to check if every element in the array is equal to a * condition. * * Internally, this just calls `Array.every`. */ export declare function every<T>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => boolean): boolean; /** * Helper function for non-TypeScript users to filter the elements in an array. Returns the filtered * array. * * Internally, this just calls `Array.filter`. */ export declare function filter<T>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => boolean): readonly T[]; /** * Helper function for non-TypeScript users to find an element in an array. * * Internally, this just calls `Array.find`. */ export declare function find<T>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => boolean): T | undefined; /** * Helper function for non-TypeScript users to iterate over an array. * * Internally, this just calls `Array.forEach`. */ export declare function forEach<T>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => void): void; /** * Helper function for non-TypeScript users to convert an array to a string with the specified * separator. * * Internally, this just calls `Array.join`. */ export declare function join(array: readonly unknown[], separator: string): string; /** * Helper function for non-TypeScript users to convert all of the elements in an array to something * else. * * Internally, this just calls `Array.map`. */ export declare function map<T, U>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => U): readonly U[]; /** * Helper function for non-TypeScript users to check if one or more elements in the array is equal * to a condition. * * Internally, this just calls `Array.some`. */ export declare function some<T>(array: readonly T[], func: (value: T, index: number, array: readonly T[]) => boolean): boolean; //# sourceMappingURL=arrayLua.d.ts.map