Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Conversion from CamelCase - 2 solution in Clear category for Conversion from CamelCase by Atadolfo
import assert from "assert";
var fromCamelCase = (name: string): string => name[0].toLowerCase() + name.substr(1).replace(/[A-Z]/g, (v: string): string => "_" + v.toLowerCase());
console.log('Example:');
console.log(fromCamelCase('MyFunctionName'));
// These "asserts" are used for self-checking
assert.equal(fromCamelCase('MyFunctionName'), 'my_function_name');
assert.equal(fromCamelCase('IPhone'), 'i_phone');
console.log("Coding complete? Click 'Check' to earn cool rewards!");
May 27, 2020
Comments: