Answers for "typescript wrapping for array"

0

typescript wrapping for array

function wrapInArray(obj: string | string[]) {
  if (typeof obj === "string") {
    return [obj];
  }
  return obj;
}
Posted by: Guest on March-18-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language