@angular/cdk
Version:
Angular Material Component Development Kit
26 lines (25 loc) • 1.03 kB
TypeScript
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Coerces a value to an array of trimmed non-empty strings.
* Any input that is not an array, `null` or `undefined` will be turned into a string
* via `toString()` and subsequently split with the given separator.
* `null` and `undefined` will result in an empty array.
* This results in the following outcomes:
* - `null` -> `[]`
* - `[null]` -> `["null"]`
* - `["a", "b ", " "]` -> `["a", "b"]`
* - `[1, [2, 3]]` -> `["1", "2,3"]`
* - `[{ a: 0 }]` -> `["[object Object]"]`
* - `{ a: 0 }` -> `["[object", "Object]"]`
*
* Useful for defining CSS classes or table columns.
* @param value the value to coerce into an array of strings
* @param separator split-separator if value isn't an array
*/
export declare function coerceStringArray(value: any, separator?: string | RegExp): string[];