* Normalize the argument to always be an array.
(data?: T | readonly T[] | Iterable<T>, strict = false)
| 340 | * Normalize the argument to always be an array. |
| 341 | */ |
| 342 | static asArray<T>(data?: T | readonly T[] | Iterable<T>, strict = false): T[] { |
| 343 | if (typeof data === 'undefined' && !strict) { |
| 344 | return []; |
| 345 | } |
| 346 | |
| 347 | if (this.isIterable(data)) { |
| 348 | return Array.from(data); |
| 349 | } |
| 350 | |
| 351 | return [data as T]; |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * Checks if the value is iterable, but considers strings and buffers as not iterable. |
no test coverage detected