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