Comparing version 0.69.0 to 0.70.0
@@ -889,2 +889,27 @@ /** | ||
/** | ||
* camelCase updates a string to camelcase | ||
* | ||
* @param {string} [string=''] input string | ||
* @returns {string} returns new camelCase string | ||
* | ||
* @example | ||
* const result = strings.camelCase('--BEST_friend--'); | ||
* console.log(result); | ||
* > 'bestFriend' | ||
*/ | ||
function camelCase (string = '') { | ||
let first = true; | ||
const res = string.replace(/[\u2019']/, '').split(/[\u002D\u2014\-_\s]+/).reduce((acc, word) => { | ||
if (first && word.length > 0) { | ||
word = word.toLowerCase(); | ||
first = false; | ||
} else { | ||
word = word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); | ||
} | ||
return acc + word; | ||
}, ''); | ||
return res; | ||
} | ||
/** | ||
* Chomp removes record separator characters (ex \n, \r, \r\n) from the end of a string. | ||
@@ -1231,2 +1256,3 @@ * | ||
__proto__: null, | ||
camelCase: camelCase, | ||
chomp: chomp, | ||
@@ -1233,0 +1259,0 @@ endsWith: endsWith, |
{ | ||
"name": "absurdum", | ||
"version": "0.69.0", | ||
"version": "0.70.0", | ||
"description": "Reductio Ad Absurdum - The Ridiculous Application of Reduce", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -180,2 +180,3 @@ [![GitHub Releases](https://img.shields.io/github/release/vanillaes/absurdum.svg)](https://github.com/vanillaes/absurdum/releases) | ||
- [camelCase][strings.camelCase] | ||
- [chomp][strings.chomp] | ||
@@ -191,2 +192,3 @@ - [endsWith][strings.endswith] | ||
[strings.camelCase]: ./docs/strings/camelCase.md | ||
[strings.chomp]: ./docs/strings/chomp.md | ||
@@ -193,0 +195,0 @@ [strings.endswith]: ./docs/strings/endsWith.md |
@@ -0,1 +1,2 @@ | ||
export { camelCase } from "./camelCase.js"; | ||
export { chomp } from "./chomp.js"; | ||
@@ -2,0 +3,0 @@ export { endsWith } from "./endsWith.js"; |
@@ -0,1 +1,2 @@ | ||
export { camelCase } from './camelCase.js'; | ||
export { chomp } from './chomp.js'; | ||
@@ -2,0 +3,0 @@ export { endsWith } from './endsWith.js'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
264703
208
6667
209