ramda-extension
Version:
Helpful functions built on top of the mighty Ramda
20 lines (19 loc) • 593 B
JavaScript
import { o, map, toLower } from 'ramda';
import splitByNonAlphaNumeric from './splitByNonAlphaNumeric';
import joinWithDash from './joinWithDash';
/**
* Converts string into kebab-case.
*
* @func
* @category String
*
* @example
*
* R_.toKebabCase('hello-world') // 'hello-world'
* R_.toKebabCase('hello- world') // 'hello-world'
* R_.toKebabCase(' hello-/ world/ ') // 'hello-world'
*
* @sig String -> String
*/
var toKebabCase = /*#__PURE__*/o(joinWithDash, /*#__PURE__*/o( /*#__PURE__*/map(toLower), splitByNonAlphaNumeric));
export default toKebabCase;