UNPKG

lenye_base

Version:

基础方法

17 lines (13 loc) 295 B
'use strict'; /** * _ or - to CamelCase */ function camelize(target) { if (target.indexOf('-') < 0 && target.indexOf('_') < 0) { return target; } return target.replace(/[-_][^-_]/g, function (match) { return match.charAt(1).toUpperCase(); }); } module.exports = camelize;