UNPKG

@csvw-rdf-convertor/core

Version:

This library was generated with [Nx](https://nx.dev).

18 lines (17 loc) 657 B
/** * Converts the input into an array. If the input is already an array, it is returned as-is. * If the input is a single value, it is wrapped in an array. If the input is `undefined`, * an empty array is returned. * * @typeParam T - The type of the elements in the array. * @param {T} input - The value to coerce into an array. It can be a single value, an array of values, or `undefined`. * @returns An array of non-nullable elements of type `T`. */ export function coerceArray(input) { if (input === undefined) { return []; } return Array.isArray(input) ? input : [ input ]; } //# sourceMappingURL=coerce.js.map