function formatWordList(words) {
    if (!(words === null || words === void 0 ? void 0 : words.length)) {
        return '';
    }
    if (words.length === 1) {
        return words[0];
    }
    return [words.slice(0, -1).join(', '), words.slice(-1)[0]].join(' and ');
}
/**
 * Given an array of words, returns an English-friendly concatenation, separated with commas, with
 * the `and` clause inserted before the last item.
 *
 * Example: ['foo', 'bar', 'baz' ] returns the string "foo, bar, and baz".
 */
Given an array of words, returns an English-friendly concatenation, separated with commas, with
the `and` clause inserted before the last item.


Given an array of words returns an English - friendly concatenation separated with commas with the ` and ` clause inserted before the last item .
function formatWordList(words) {
    if (!(words === null || words === void 0 ? void 0 : words.length)) {
        return '';
    }
    if (words.length === 1) {
        return words[0];
    }
    return [words.slice(0, -1).join(', '), words.slice(-1)[0]].join(' and ');
}
function formatWordList ( words ) { if ( ! ( words === null || words === void 0 ? void 0 : words . length ) ) { return '' ; } if ( words . length === 1 ) { return words [ 0 ] ; } return [ words . slice ( 0 , - 1 ) . join ( ', ' ) , words . slice ( - 1 ) [ 0 ] ] . join ( ' and ' ) ; }
Given an array of words, returns an English-friendly concatenation, separated with commas, with
 the `and` clause inserted before the last item.
Given an array of words returns an English - friendly concatenation separated with commas with the ` and ` clause inserted before the last item .