ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
30 lines (27 loc) • 825 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _ramda = require("ramda");
/**
* For not-nil string returns string where every single word starts with a lower-case letter.
*
* @func
* @category String
*
* @param {any} x Any string
* @return {any} String where every word starts with lower-case letter
*
* @example
*
* R_.decapitalizeAll('Seek And Destroy') // seek and destroy
* R_.decapitalizeAll('seek and destroy') // seek and destroy
* R_.decapitalizeAll(null) // null
* R_.decapitalizeAll(undefined) // undefined
*
* @sig String -> String
*/
var decapitalizeAll = (0, _ramda.unless)(_ramda.isNil, (0, _ramda.replace)(/(\b\w(?!\s))/g, _ramda.toLower));
var _default = decapitalizeAll;
exports.default = _default;