perf: Remove dependency and improve performance (#11)

pull/14/head
Guillaume Martigny 2018-08-23 03:47:55 +02:00 zatwierdzone przez Amio /
rodzic 9b41a3b570
commit 80a2f3b38a
3 zmienionych plików z 655 dodań i 339 usunięć

Wyświetl plik

@ -1,5 +1,4 @@
const widthsVerdana11 = require('./widths-verdana-11.json')
const astralRegex = require('unicode-astral-regex')
const SCALE = 10 // Prevent results like 60.599999999999994
@ -8,7 +7,7 @@ const calcWidth = (charWidthTable) => {
widthTable[64] = widthTable[64] + 6 // Slightly increase width of "@" by 0.6px
return (text, astral) => {
if (astral) text = text.match(astralRegex) || []
if (astral) text = [...text]
let total = 0
let code = 0

987
package-lock.json wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -20,7 +20,5 @@
"standard": "^11.0.1",
"tap": "^12.0.1"
},
"dependencies": {
"unicode-astral-regex": "^1.0.1"
}
"dependencies": {}
}