Files
directus/api/src/utils/to-array.ts
dependabot[bot] bc30ee2bde Bump prettier from 2.2.1 to 2.3.0 (#5593)
* Bump prettier from 2.2.1 to 2.3.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.2.1...2.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Fix lint issues for updated prettier

* Lets remove dev: true again so we can auto-add it later why don't we

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-11 10:38:42 -04:00

8 lines
177 B
TypeScript

export function toArray<T = any>(val: T | T[]): T[] {
if (typeof val === 'string') {
return val.split(',') as unknown as T[];
}
return Array.isArray(val) ? val : [val];
}