perf: remove transient strings to reduce memory

This commit is contained in:
harttle
2020-03-14 19:04:18 +08:00
committed by Jun Yang
parent 0f25017d5d
commit 3dfdf982c9
16 changed files with 124 additions and 125 deletions
+1 -5
View File
@@ -80,6 +80,7 @@ export class Context {
private parseProp (str: string) {
str = String(str)
const seq: string[] = []
const push = () => name.length && (seq.push(name), (name = ''))
let name = ''
let j
let i = 0
@@ -120,11 +121,6 @@ export class Context {
throw new TypeError(`invalid path:"${str}"`)
}
return seq
function push () {
if (name.length) seq.push(name)
name = ''
}
}
}