智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/33/335fd1dbc9a3e2405e4c49fb9a9...

22 lines
457 B

function cached (fn) {
const cache = Object.create(null)
return function cachedFn (str) {
const hit = cache[str]
return hit || (cache[str] = fn(str))
}
}
const camelizeRE = /-(\w)/g
const camelize = cached(function (str) {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')
})
const capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
})
module.exports = {
camelize,
capitalize
}