UNPKG

ts-cast

Version:
13 lines (12 loc) 625 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withName = exports.joinNames = void 0; var joinNames = function (names, conjunction) { return (names.length === 0 ? '' : names.length === 1 ? names[0] : names.length === 2 ? "".concat(names[0], " ").concat(conjunction, " ").concat(names[1]) : "".concat(names.slice(0, -1).join(', '), " ").concat(conjunction, " ").concat(names[names.length - 1])); }; exports.joinNames = joinNames; var withName = function (obj, name) { return Object.defineProperty(obj, 'name', { value: name }); }; exports.withName = withName;