react-mapfilter
Version:
These components are designed for viewing data in Mapeo. They share a common interface:
35 lines (29 loc) • 960 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.sentenceCase = sentenceCase;
exports.titleCase = titleCase;
exports.capitalize = capitalize;
exports.t = t;
function sentenceCase() {
var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
// Matches the first letter in the string and the first letter that follows a
// period (and 1 or more spaces) and transforms that letter to uppercase.
return s.replace(/(^[a-z])|(\.\s*[a-z])/g, function (s) {
return s.toUpperCase();
});
}
function titleCase(str) {
return str.toLowerCase().split(' ').map(function (word) {
return capitalize(word);
}).join(' ');
}
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
function t() {
var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return sentenceCase(s.replace(/_/g, ' '));
}
//# sourceMappingURL=text_helpers.js.map