slanted-gamedev-toolz
Version:
A slanted mix of tools for your brilliant ideas in game design.
27 lines (26 loc) • 912 B
TypeScript
/**
* Returns a random item from the provided array.
*
* @param {any[]} array - The array to pick a random item from.
* @returns {any} A random element from the array.
*
* @example
* const fruits = ['apple', 'banana', 'cherry'];
* const randomFruit = randomArrayItem(fruits);
* console.log(randomFruit); // e.g., 'banana'
*/
export declare const randomArrayItem: (array: any[]) => any;
/**
* Removes objects from the first array if their `name` property matches any object's `name` in the second array.
*
* @param arr1 - The source array of objects to filter.
* @param arr2 - The array of objects whose `name` properties should be excluded from `arr1`.
* @returns A new array containing only the objects from `arr1` whose `name` is not present in `arr2`.
*/
export declare function removeObjectsWithSameName(arr1: {
name: string;
}[], arr2: {
name: string;
}[]): {
name: string;
}[];