UNPKG

@alifd/adaptor-helper

Version:
24 lines (18 loc) 547 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toLabelWord = exports.firstUpperCase = void 0; var firstUpperCase = function firstUpperCase(str) { if (!str) { return ""; } return [str.substring(0, 1).toUpperCase(), str.substring(1)].join(""); }; exports.firstUpperCase = firstUpperCase; var toLabelWord = function toLabelWord(str) { return str.replace(/\B([A-Z])/g, "-$1").split(/[-|_]/).map(function (s) { return firstUpperCase(s); }).join(" "); }; exports.toLabelWord = toLabelWord;