Update shape.js

fix: missing cache ucfirst.
This commit is contained in:
vellengs 2019-11-20 22:06:13 +08:00 committed by GitHub
parent eeb48f0b39
commit afc1c9dd8d

View File

@ -10,7 +10,9 @@ const Shape = {};
const cache = {}; // ucfirst 开销过大,进行缓存
// 首字母大写
function ucfirst(str) {
cache[str] = cache[str] || Util.upperFirst(str);
if (!cache[str]) {
cache[str] = Util.upperFirst(str);
}
return cache[str];
}