synapse-react-client
Version:
[](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [](https://badge.fury.io/js/synaps
23 lines • 850 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.unCamelCase = void 0;
var unCamelCase = function (str, facetAliases) {
// https://stackoverflow.com/questions/4149276/how-to-convert-camelcase-to-camel-case
if (!str) {
return str;
}
if (facetAliases === null || facetAliases === void 0 ? void 0 : facetAliases[str]) {
return facetAliases[str];
}
return (str
// insert a space between lower & upper
.replace(/([a-z])([A-Z])/g, '$1 $2')
// space before last upper in a sequence followed by lower
.replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3')
// uppercase the first character
.replace(/^./, function (str) {
return str.toUpperCase();
}));
};
exports.unCamelCase = unCamelCase;
//# sourceMappingURL=unCamelCase.js.map