UNPKG

@alifd/adaptor-helper

Version:
12 lines (11 loc) 346 B
export var firstUpperCase = function firstUpperCase(str) { if (!str) { return ""; } return [str.substring(0, 1).toUpperCase(), str.substring(1)].join(""); }; export var toLabelWord = function toLabelWord(str) { return str.replace(/\B([A-Z])/g, "-$1").split(/[-|_]/).map(function (s) { return firstUpperCase(s); }).join(" "); };