1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-26 01:00:27 +02:00

Fix low severity issues in the JavaScript (#3342)

This commit is contained in:
Eric Cornelissen 2020-07-28 13:33:40 +03:00 committed by GitHub
parent d4b07ad447
commit 7fb4ff6395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -90,7 +90,7 @@ module.exports = {
iconIgnored.size.hasOwnProperty(iconPath) ||
iconIgnored.center.hasOwnProperty(iconPath)
) {
return
return;
}
const targetCenter = iconSize / 2;

View File

@ -28,7 +28,7 @@ const { titleToFilename } = require("./utils");
// Local helper functions
function escape(value) {
return value.replace(/'/g, "\\'");
return value.replace(/(?<!\\)'/g, "\\'");
}
function iconToKeyValue(icon) {
const iconTitle = escape(icon.title);

View File

@ -32,7 +32,7 @@ module.exports = {
*/
htmlFriendlyToTitle: htmlFriendlyTitle => (
htmlFriendlyTitle
.replace(/&amp;/g, "&")
.replace(/&apos;/g, "’")
.replace(/&amp;/g, "&")
)
}

View File

@ -59,7 +59,7 @@
// - https://davidwalsh.name/query-string-javascript
// - https://github.com/WebReflection/url-search-params
function getUrlParameter(parameter) {
name = parameter.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var name = parameter.replace(/[\[]/g, '\\[').replace(/[\]]/g, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
@ -84,9 +84,9 @@
queryLetters = query.split('');
var matchedIcons = icons.filter(function(iconName, iconIndex) {
var element = $icons[iconIndex],
score = iconName.length - query.length;
index = 0;
var element = $icons[iconIndex];
var score = iconName.length - query.length;
var index = 0;
for (var i = 0; i < queryLetters.length; i++) {
var letter = queryLetters[i];