Skip to content

Commit

Permalink
improve performance of getIconSize() (#10125)
Browse files Browse the repository at this point in the history
* load icons once on module load
  • Loading branch information
chris48s authored Apr 26, 2024
1 parent edae807 commit 46ed6f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/svg-helpers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import SVGPathCommander from 'svg-path-commander'
import loadSimpleIcons from './load-simple-icons.js'

const simpleIcons = loadSimpleIcons()

function svg2base64(svg) {
return `data:image/svg+xml;base64,${Buffer.from(svg.trim()).toString(
'base64',
)}`
}

function getIconSize(iconKey) {
const simpleIcons = loadSimpleIcons()

if (!(iconKey in simpleIcons)) {
return undefined
}
Expand Down

0 comments on commit 46ed6f0

Please sign in to comment.