Skip to content

Commit

Permalink
update to remove any non specific characters
Browse files Browse the repository at this point in the history
Only accept the following characters and remove anything else:
a-z (case insensitive)
0-9
-
.
  • Loading branch information
RedSparr0w committed Jul 8, 2019
1 parent 477e5ac commit 1357031
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/load-simple-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ const { svg2base64 } = require('./svg-helpers')
function loadSimpleIcons() {
// Apply other key bindings
Object.keys(simpleIcons).forEach(key => {
const _key = key.toLowerCase().replace(/[^a-z0-9]/gi, '')
const _key = key
.toLowerCase()
.replace(/ /g, '-')
.replace(/[^\-.a-z0-9]/gi, '')
if (key !== _key) {
simpleIcons[_key] = simpleIcons[key]
delete simpleIcons[key]
Expand Down
2 changes: 1 addition & 1 deletion lib/logos.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getSimpleIconStyle({ icon, style }) {
}

function getSimpleIcon({ name, color, style }) {
const key = name.replace(/[^a-z0-9]/gi, '')
const key = name.replace(/ /g, '-').replace(/[^\-.a-z0-9]/gi, '')

if (!(key in simpleIcons)) {
return undefined
Expand Down

0 comments on commit 1357031

Please sign in to comment.