@iconify/tools
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -5,3 +5,3 @@ { | ||
"author": "Vjacheslav Trushkin", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "bugs": "https://github.com/iconify-design/tools/issues", | ||
"dependencies": { | ||
"@iconify/json-tools": "^1.0.0", | ||
"@iconify/json-tools": "^1.0.5", | ||
"cheerio": "^0.22.0", | ||
@@ -26,0 +26,0 @@ "cyberalien-color": "*", |
@@ -51,3 +51,3 @@ /** | ||
constructor(param) { | ||
this.items = {}; | ||
this.items = Object.create(null); | ||
this.prefix = typeof param === 'string' ? param : ''; | ||
@@ -118,3 +118,3 @@ | ||
// Find all possible prefixes | ||
let commonPrefix = {}, | ||
let commonPrefix = Object.create(null), | ||
complexPrefix = ''; | ||
@@ -189,3 +189,3 @@ | ||
let items = {}; | ||
let items = Object.create(null); | ||
let start = newPrefix.length + 1; | ||
@@ -284,5 +284,5 @@ Object.keys(this.items).forEach(key => { | ||
results = { | ||
success: {}, | ||
error: {}, | ||
skipped: {} | ||
success: Object.create(null), | ||
error: Object.create(null), | ||
skipped: Object.create(null) | ||
}; | ||
@@ -360,3 +360,3 @@ | ||
Promise.all(promises).then(results => { | ||
let filtered = {}; | ||
let filtered = Object.create(null); | ||
resultKeys.forEach((key, index) => { | ||
@@ -392,3 +392,3 @@ filtered[key] = results[index]; | ||
// Check options | ||
options = options ? options : {}; | ||
options = options ? options : Object.create(null); | ||
Object.keys(defaultMergeOptions).forEach(key => { | ||
@@ -404,6 +404,6 @@ if (options[key] === void 0) { | ||
// Find all aliases and hash all icons | ||
let newAliases = {}, | ||
newHashes = {}, | ||
oldHashes = {}, | ||
newChars = {}; | ||
let newAliases = Object.create(null), | ||
newHashes = Object.create(null), | ||
oldHashes = Object.create(null), | ||
newChars = Object.create(null); | ||
@@ -539,3 +539,3 @@ newKeys.forEach(key => { | ||
// Missing alias | ||
newSVG.aliases.push(typeof alias === 'string' ? alias : Object.assign({}, alias)); | ||
newSVG.aliases.push(typeof alias === 'string' ? alias : Object.assign(Object.create(null), alias)); | ||
newAliases[name] = oldKey; | ||
@@ -542,0 +542,0 @@ } |
@@ -126,3 +126,3 @@ /** | ||
// Mix values with parent values | ||
attributes = Object.assign({}, params); | ||
attributes = Object.assign(Object.create(null), params); | ||
@@ -129,0 +129,0 @@ // Check for fill and stroke |
@@ -60,3 +60,3 @@ /** | ||
module.exports = (collection, target, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -63,0 +63,0 @@ if (options[key] === void 0) { |
@@ -56,3 +56,3 @@ /** | ||
module.exports = (collection, target, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -69,4 +69,4 @@ if (options[key] === void 0) { | ||
return new Promise((fulfill, reject) => { | ||
let json = {}, | ||
categories = {}; | ||
let json = Object.create(null), | ||
categories = Object.create(null); | ||
@@ -81,3 +81,3 @@ if (options.separatePrefix) { | ||
json.icons = {}; | ||
json.icons = Object.create(null); | ||
@@ -141,3 +141,3 @@ // Export all files | ||
if (options.includeAliases) { | ||
let aliases = {}; | ||
let aliases = Object.create(null); | ||
@@ -194,3 +194,3 @@ collection.forEach((svg, key) => { | ||
keys.sort((a, b) => a.localeCompare(b)); | ||
json.aliases = {}; | ||
json.aliases = Object.create(null); | ||
keys.forEach(key => { | ||
@@ -204,3 +204,3 @@ json.aliases[key] = aliases[key]; | ||
if (options.includeChars) { | ||
let chars = {}; | ||
let chars = Object.create(null); | ||
collection.forEach((svg, key) => { | ||
@@ -224,3 +224,3 @@ if (svg.char === void 0) { | ||
keys.sort((a, b) => a.localeCompare(b)); | ||
json.chars = {}; | ||
json.chars = Object.create(null); | ||
keys.forEach(key => { | ||
@@ -238,3 +238,3 @@ json.chars[key] = chars[key]; | ||
categoryKeys.sort((a, b) => a.localeCompare(b)); | ||
json.categories = {}; | ||
json.categories = Object.create(null); | ||
categoryKeys.forEach(key => { | ||
@@ -241,0 +241,0 @@ categories[key].sort((a, b) => a.localeCompare(b)); |
@@ -24,3 +24,3 @@ /** | ||
module.exports = (svg, target, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -27,0 +27,0 @@ if (options[key] === void 0) { |
@@ -104,3 +104,3 @@ /** | ||
module.exports = (source, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -107,0 +107,0 @@ if (options[key] === void 0) { |
@@ -34,3 +34,3 @@ /** | ||
// List of changes for each character: [hex] = {height: 1000} | ||
characterChanges: {}, | ||
characterChanges: Object.create(null), | ||
@@ -107,3 +107,3 @@ // Crop glyphs | ||
module.exports = (source, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -144,3 +144,3 @@ if (options[key] === void 0) { | ||
// Crop queue | ||
let cropQueue = {}; | ||
let cropQueue = Object.create(null); | ||
@@ -316,3 +316,3 @@ // Find fonts | ||
defaultLeftLimit: false | ||
}, typeof options.crop === 'object' ? options.crop : {}); | ||
}, typeof options.crop === 'object' ? options.crop : Object.create(null)); | ||
@@ -319,0 +319,0 @@ cropOptions.multiple = true; |
@@ -28,3 +28,3 @@ /** | ||
module.exports = (source, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -79,3 +79,3 @@ if (options[key] === void 0) { | ||
} | ||
let alias = Object.assign({}, json.aliases[aliasKey]); | ||
let alias = Object.assign(Object.create(null), json.aliases[aliasKey]); | ||
delete alias.parent; | ||
@@ -82,0 +82,0 @@ alias.name = aliasKey; |
@@ -26,3 +26,3 @@ /** | ||
module.exports = (source, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -29,0 +29,0 @@ if (options[key] === void 0) { |
@@ -63,3 +63,3 @@ /** | ||
module.exports = (source, options) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -66,0 +66,0 @@ if (options[key] === void 0) { |
@@ -40,3 +40,3 @@ /** | ||
} | ||
results = {}; | ||
results = Object.create(null); | ||
@@ -364,4 +364,4 @@ next(); | ||
redraw = false, | ||
sideLimits = {}, | ||
limitMultipliers = {}; | ||
sideLimits = Object.create(null), | ||
limitMultipliers = Object.create(null); | ||
@@ -368,0 +368,0 @@ // Check all sides for filled pixels |
@@ -90,3 +90,3 @@ /** | ||
return new Promise((fulfill, reject) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -98,3 +98,3 @@ if (options[key] === void 0) { | ||
let cache = {}, | ||
let cache = Object.create(null), | ||
results = []; | ||
@@ -147,3 +147,3 @@ | ||
} else { | ||
item.source = Object.assign({}, item.source); | ||
item.source = Object.assign(Object.create(null), item.source); | ||
} | ||
@@ -259,3 +259,3 @@ | ||
// Generate source data | ||
let data = {}; | ||
let data = Object.create(null); | ||
items.forEach(item => { | ||
@@ -265,3 +265,3 @@ data[item.key] = item.source; | ||
// Copy object and overwrite body | ||
data[item.key] = Object.assign({}, data[item.key], { | ||
data[item.key] = Object.assign(Object.create(null), data[item.key], { | ||
body: item.body | ||
@@ -451,3 +451,3 @@ }); | ||
case 'object': | ||
return Object.assign(typeof original === 'object' ? original : {}, data); | ||
return Object.assign(typeof original === 'object' ? original : Object.create(null), data); | ||
@@ -472,8 +472,8 @@ default: | ||
// Make shallow copy to keep old stuff | ||
svg = Object.assign({}, svg); | ||
svg = Object.assign(Object.create(null), svg); | ||
results.forEach(item => { | ||
if (typeof svg[item.key] === 'object' && !(svg[item.key] instanceof SVG)) { | ||
svg[item.key] = Object.assign({}, svg[item.key]); | ||
svg[item.key] = Object.assign(Object.create(null), svg[item.key]); | ||
} | ||
svg[item.key] = generateResultItem(generateResultObject(item), options.format, svg[item.key] === void 0 ? {} : svg[item.key], item); | ||
svg[item.key] = generateResultItem(generateResultObject(item), options.format, svg[item.key] === void 0 ? Object.create(null) : svg[item.key], item); | ||
}); | ||
@@ -480,0 +480,0 @@ |
@@ -34,3 +34,3 @@ /** | ||
// Set options | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -37,0 +37,0 @@ if (options[key] === void 0) { |
@@ -37,3 +37,3 @@ /** | ||
// Set options | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
Object.keys(defaults).forEach(key => { | ||
@@ -49,5 +49,5 @@ if (options[key] === void 0) { | ||
rootAttributes = $root.get(0).attribs, | ||
styles = {}, | ||
usedSelectors = {}, | ||
keepSelectors = {}, | ||
styles = Object.create(null), | ||
usedSelectors = Object.create(null), | ||
keepSelectors = Object.create(null), | ||
complexSelectors = false, | ||
@@ -209,3 +209,3 @@ styleTags = [], | ||
if (styles[selector] === void 0) { | ||
styles[selector] = {}; | ||
styles[selector] = Object.create(null); | ||
} | ||
@@ -391,3 +391,3 @@ styles[selector][key] = token; | ||
case 'radialGradient': | ||
checkShape($child, child, Object.assign({}, extra, {gradient: true})); | ||
checkShape($child, child, Object.assign(Object.create(null), extra, {gradient: true})); | ||
return; | ||
@@ -430,3 +430,3 @@ | ||
// Check root attributes | ||
let groupAttributes = {}; | ||
let groupAttributes = Object.create(null); | ||
@@ -460,3 +460,3 @@ Object.keys(rootAttributes).forEach(attr => { | ||
try { | ||
checkChildElements($root, {}); | ||
checkChildElements($root, Object.create(null)); | ||
} catch (err) { | ||
@@ -463,0 +463,0 @@ reject(err); |
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
let convert = {}; | ||
let convert = Object.create(null); | ||
@@ -25,0 +25,0 @@ /** |
@@ -40,3 +40,3 @@ /** | ||
return new Promise((fulfill, reject) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
changeOptions(options, defaults); | ||
@@ -61,3 +61,3 @@ | ||
if (options.checkFillStroke) { | ||
childStyle = {}; | ||
childStyle = Object.create(null); | ||
['fill', 'stroke'].forEach(attr => { | ||
@@ -64,0 +64,0 @@ if (child.attribs && child.attribs[attr] !== void 0) { |
@@ -84,5 +84,5 @@ /** | ||
function normalizeAttributes($node, params, defaults) { | ||
defaults = defaults === void 0 ? {} : defaults; | ||
defaults = defaults === void 0 ? Object.create(null) : defaults; | ||
let results = {}, | ||
let results = Object.create(null), | ||
keys = Object.keys(params), | ||
@@ -157,3 +157,3 @@ i, value, key; | ||
*/ | ||
const calculate = {}; | ||
let calculate = Object.create(null); | ||
@@ -340,3 +340,3 @@ /** | ||
*/ | ||
let converter = {}, | ||
let converter = Object.create(null), | ||
converterData = { | ||
@@ -491,6 +491,6 @@ rect: { | ||
return new Promise((fulfill, reject) => { | ||
options = options === void 0 ? {} : options; | ||
options = options === void 0 ? Object.create(null) : options; | ||
changeOptions(options, defaults); | ||
let shapes = {}, | ||
let shapes = Object.create(null), | ||
queue = [], | ||
@@ -516,3 +516,3 @@ tempKeyAttribute = '_lengthKey'; | ||
// Copy options to overwrite shapeCallback | ||
let indexOptions = Object.assign({}, options); | ||
let indexOptions = Object.assign(Object.create(null), options); | ||
indexOptions.checkFillStroke = true; | ||
@@ -638,3 +638,3 @@ | ||
function done() { | ||
let results = {}; | ||
let results = Object.create(null); | ||
@@ -641,0 +641,0 @@ Object.keys(shapes).forEach(key => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
187841
Updated@iconify/json-tools@^1.0.5