@terminus/ngx-tools
Version:
[![CircleCI][circle-badge]][circle-link] [![codecov][codecov-badge]][codecov-project] [![semantic-release][semantic-release-badge]][semantic-release] [![MIT License][license-image]][license-url] <br> [![NPM version][npm-version-image]][npm-url] [![Github
13 lines (12 loc) • 417 B
TypeScript
/**
* Determine if all array elements are of a certain type
*
* @param x - The array to test
* @param guard - The function to test for the specific type
* @returns The result
*
* @example
* isArrayOfType<number>([1, 5], isNumber) // Returns: true
* isArrayOfType<number>([1, 'foo'], isNumber) // Returns: false
*/
export declare function isArrayOfType<T>(x: any[], guard: (y: any) => y is T): x is T[];