Convert snake-case to camelCase

Source: https://coderwall.com/p/iprsng/convert-snake-case-to-camelcase

function snakeToCamel(s){
    return s.replace(/(\-\w)/g, function(m){return m[1].toUpperCase();});
}
or as more readable code


var snakeCaseString = 'lorem-ipsum';

var find = /(\-\w)/g;
var convert =  function(matches){
    return matches[1].toUpperCase();
};
var camelCaseString = snakeCaseString.replace(
    find,
    convert
);

Không có nhận xét nào:

Is there a way to chain multiple tailwind css classes on a single hover instance?

 https://stackoverflow.com/questions/73524088/is-there-a-way-to-chain-multiple-tailwind-css-classes-on-a-single-hover-instance There is a wa...