Converts an array of anything into a human friendly list.
Returns a new array that contains the items separated by commas, except for the last item, which is separated by "and". This is useful for creating human-friendly sentences.
Token[].
const items = ['apple', 'banana', {command: "--flag"}]; const result = asHumanFriendlyList(items) // ['apple', ',', 'banana', ',', 'and', {command: "--flag"}] console.log(result); Copy
const items = ['apple', 'banana', {command: "--flag"}]; const result = asHumanFriendlyList(items) // ['apple', ',', 'banana', ',', 'and', {command: "--flag"}] console.log(result);
Converts an array of anything into a human friendly list.
Returns a new array that contains the items separated by commas, except for the last item, which is separated by "and". This is useful for creating human-friendly sentences.