recoder-code
Version:
🚀 AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!
10 lines (8 loc) • 297 B
text/typescript
const { isArray } = Array;
/**
* Used in operators and functions that accept either a list of arguments, or an array of arguments
* as a single argument.
*/
export function argsOrArgArray<T>(args: (T | T[])[]): T[] {
return args.length === 1 && isArray(args[0]) ? args[0] : (args as T[]);
}