@iconify/utils
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -1,2 +0,2 @@ | ||
import type { FullIconCustomisations } from '../customisations'; | ||
import type { FullIconCustomisations } from './index'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Compare sets of cusotmisations, return false if they are different, true if the same |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.compare = void 0; | ||
const customisations_1 = require("../customisations"); | ||
const index_1 = require("./index"); | ||
// Get all keys | ||
const allKeys = Object.keys(customisations_1.defaults); | ||
const allKeys = Object.keys(index_1.defaults); | ||
// All keys without width/height | ||
@@ -8,0 +8,0 @@ const filteredKeys = allKeys.filter((key) => key !== 'width' && key !== 'height'); |
@@ -1,2 +0,2 @@ | ||
import type { IconifyIconCustomisations } from '../customisations'; | ||
import type { IconifyIconCustomisations } from './index'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Additional shorthand customisations |
import type { IconifyJSON } from '@iconify/types'; | ||
import { IconifyIcon, FullIconifyIcon } from '../icon'; | ||
import { IconifyIcon } from '../icon'; | ||
import type { FullIconifyIcon } from '../icon'; | ||
/** | ||
@@ -4,0 +5,0 @@ * Get data for icon |
@@ -22,3 +22,3 @@ "use strict"; | ||
if (result) { | ||
merge_1.mergeIconData(result, item); | ||
(0, merge_1.mergeIconData)(result, item); | ||
} | ||
@@ -45,4 +45,4 @@ return result; | ||
// Return icon | ||
return result && full ? icon_1.fullIcon(result) : result; | ||
return result && full ? (0, icon_1.fullIcon)(result) : result; | ||
} | ||
exports.getIconData = getIconData; |
@@ -56,5 +56,7 @@ "use strict"; | ||
// Find value that is used by most icons | ||
let maxCount = 0, maxValue = null, counters = new Map(); | ||
let maxCount = 0; | ||
let maxValue = null; | ||
const counters = new Map(); | ||
for (let i = 0; i < icons.length; i++) { | ||
let item = data.icons[icons[i]]; | ||
const item = data.icons[icons[i]]; | ||
let value; | ||
@@ -61,0 +63,0 @@ if (typeof item[prop] === 'number') { |
@@ -16,3 +16,3 @@ "use strict"; | ||
if (icons[parent] !== void 0) { | ||
return merge_1.mergeIconData(icons[parent], alias); | ||
return (0, merge_1.mergeIconData)(icons[parent], alias); | ||
} | ||
@@ -26,3 +26,3 @@ if (aliases[parent] !== void 0) { | ||
if (icon) { | ||
return merge_1.mergeIconData(icon, alias); | ||
return (0, merge_1.mergeIconData)(icon, alias); | ||
} | ||
@@ -29,0 +29,0 @@ } |
@@ -49,4 +49,3 @@ "use strict"; | ||
case 'rotate': | ||
// Legacy properties | ||
case 'inlineHeight': | ||
case 'inlineHeight': // Legacy properties | ||
case 'inlineTop': | ||
@@ -167,2 +166,3 @@ case 'verticalAlign': | ||
const failedAliases = new Set(); | ||
// eslint-disable-next-line no-inner-declarations | ||
function validateAlias(name, iteration) { | ||
@@ -169,0 +169,0 @@ // Check if alias has already been validated |
import type { IconifyOptional } from '@iconify/types'; | ||
import type { FullIconifyIcon, IconifyIcon } from '.'; | ||
import type { FullIconifyIcon, IconifyIcon } from './index'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Merge icon and alias |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mergeIconData = void 0; | ||
const _1 = require("."); | ||
const index_1 = require("./index"); | ||
/** | ||
@@ -10,3 +10,3 @@ * Merge icon and alias | ||
const result = { ...icon }; | ||
for (const key in _1.iconDefaults) { | ||
for (const key in index_1.iconDefaults) { | ||
const prop = key; | ||
@@ -13,0 +13,0 @@ if (alias[prop] !== void 0) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateIcon = exports.stringToIcon = void 0; | ||
const _1 = require("."); | ||
const index_1 = require("./index"); | ||
/** | ||
@@ -33,3 +33,3 @@ * Convert string to Icon object. | ||
}; | ||
return validate && !exports.validateIcon(result) ? null : result; | ||
return validate && !(0, exports.validateIcon)(result) ? null : result; | ||
} | ||
@@ -45,3 +45,3 @@ // Attempt to split by dash: "prefix-name" | ||
}; | ||
return validate && !exports.validateIcon(result) ? null : result; | ||
return validate && !(0, exports.validateIcon)(result) ? null : result; | ||
} | ||
@@ -55,3 +55,3 @@ // If allowEmpty is set, allow empty provider and prefix, allowing names like "home" | ||
}; | ||
return validate && !exports.validateIcon(result, allowSimpleName) | ||
return validate && !(0, exports.validateIcon)(result, allowSimpleName) | ||
? null | ||
@@ -72,7 +72,7 @@ : result; | ||
} | ||
return !!((icon.provider === '' || icon.provider.match(_1.matchName)) && | ||
return !!((icon.provider === '' || icon.provider.match(index_1.matchName)) && | ||
((allowSimpleName && icon.prefix === '') || | ||
icon.prefix.match(_1.matchName)) && | ||
icon.name.match(_1.matchName)); | ||
icon.prefix.match(index_1.matchName)) && | ||
icon.name.match(index_1.matchName)); | ||
}; | ||
exports.validateIcon = validateIcon; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.iconToSVG = void 0; | ||
const size_1 = require("../svg/size"); | ||
const size_1 = require("./size"); | ||
/** | ||
@@ -137,3 +137,3 @@ * Get preserveAspectRatio value | ||
height = '1em'; | ||
width = size_1.calculateSize(height, box.width / box.height); | ||
width = (0, size_1.calculateSize)(height, box.width / box.height); | ||
} | ||
@@ -149,3 +149,3 @@ else if (customisations.width !== null && | ||
height = customisations.height; | ||
width = size_1.calculateSize(height, box.width / box.height); | ||
width = (0, size_1.calculateSize)(height, box.width / box.height); | ||
} | ||
@@ -155,3 +155,3 @@ else { | ||
width = customisations.width; | ||
height = size_1.calculateSize(width, box.height / box.width); | ||
height = (0, size_1.calculateSize)(width, box.height / box.width); | ||
} | ||
@@ -158,0 +158,0 @@ // Check for 'auto' |
120
package.json
@@ -5,3 +5,3 @@ { | ||
"author": "Vjacheslav Trushkin", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"license": "MIT", | ||
@@ -16,20 +16,112 @@ "bugs": "https://github.com/iconify/iconify/issues", | ||
"scripts": { | ||
"cleanup": "rm -rf lib compiled-tests", | ||
"lint": "npx eslint {src,tests}/**/*.ts", | ||
"build": "npx tsc -b", | ||
"build:src": "npx tsc --project src/tsconfig.json", | ||
"test": "npx mocha tests-compiled/*-test.js", | ||
"pretest": "npm run build" | ||
"clean": "rimraf lib tests-compiled tsconfig.tsbuildinfo", | ||
"lint": "eslint src/**/*.ts", | ||
"prebuild": "npm run lint && npm run clean", | ||
"build": "node build", | ||
"test:jest": "jest --runInBand", | ||
"test:jasmine": "cross-env NODE_OPTIONS=--experimental-vm-modules npx jasmine", | ||
"test": "npm run test:jest && npm run test:jasmine" | ||
}, | ||
"exports": { | ||
"./lib/customisations/bool": { | ||
"require": "./lib/customisations/bool.js", | ||
"import": "./lib/customisations/bool.mjs" | ||
}, | ||
"./lib/customisations/compare": { | ||
"require": "./lib/customisations/compare.js", | ||
"import": "./lib/customisations/compare.mjs" | ||
}, | ||
"./lib/customisations/": { | ||
"require": "./lib/customisations/index.js", | ||
"import": "./lib/customisations/index.mjs" | ||
}, | ||
"./lib/customisations": { | ||
"require": "./lib/customisations/index.js", | ||
"import": "./lib/customisations/index.mjs" | ||
}, | ||
"./lib/customisations/index": { | ||
"require": "./lib/customisations/index.js", | ||
"import": "./lib/customisations/index.mjs" | ||
}, | ||
"./lib/customisations/rotate": { | ||
"require": "./lib/customisations/rotate.js", | ||
"import": "./lib/customisations/rotate.mjs" | ||
}, | ||
"./lib/customisations/shorthand": { | ||
"require": "./lib/customisations/shorthand.js", | ||
"import": "./lib/customisations/shorthand.mjs" | ||
}, | ||
"./lib/icon-set/expand": { | ||
"require": "./lib/icon-set/expand.js", | ||
"import": "./lib/icon-set/expand.mjs" | ||
}, | ||
"./lib/icon-set/get-icon": { | ||
"require": "./lib/icon-set/get-icon.js", | ||
"import": "./lib/icon-set/get-icon.mjs" | ||
}, | ||
"./lib/icon-set/get-icons": { | ||
"require": "./lib/icon-set/get-icons.js", | ||
"import": "./lib/icon-set/get-icons.mjs" | ||
}, | ||
"./lib/icon-set/minify": { | ||
"require": "./lib/icon-set/minify.js", | ||
"import": "./lib/icon-set/minify.mjs" | ||
}, | ||
"./lib/icon-set/parse": { | ||
"require": "./lib/icon-set/parse.js", | ||
"import": "./lib/icon-set/parse.mjs" | ||
}, | ||
"./lib/icon-set/validate": { | ||
"require": "./lib/icon-set/validate.js", | ||
"import": "./lib/icon-set/validate.mjs" | ||
}, | ||
"./lib/icon/": { | ||
"require": "./lib/icon/index.js", | ||
"import": "./lib/icon/index.mjs" | ||
}, | ||
"./lib/icon": { | ||
"require": "./lib/icon/index.js", | ||
"import": "./lib/icon/index.mjs" | ||
}, | ||
"./lib/icon/index": { | ||
"require": "./lib/icon/index.js", | ||
"import": "./lib/icon/index.mjs" | ||
}, | ||
"./lib/icon/merge": { | ||
"require": "./lib/icon/merge.js", | ||
"import": "./lib/icon/merge.mjs" | ||
}, | ||
"./lib/icon/name": { | ||
"require": "./lib/icon/name.js", | ||
"import": "./lib/icon/name.mjs" | ||
}, | ||
"./lib/svg/build": { | ||
"require": "./lib/svg/build.js", | ||
"import": "./lib/svg/build.mjs" | ||
}, | ||
"./lib/svg/id": { | ||
"require": "./lib/svg/id.js", | ||
"import": "./lib/svg/id.mjs" | ||
}, | ||
"./lib/svg/size": { | ||
"require": "./lib/svg/size.js", | ||
"import": "./lib/svg/size.mjs" | ||
} | ||
}, | ||
"dependencies": { | ||
"@iconify/types": "^1.0.6" | ||
"@iconify/types": "^1.0.7" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.18", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^15.3.0", | ||
"chai": "^4.3.4", | ||
"mocha": "^8.4.0", | ||
"typescript": "^4.2.4" | ||
"@iconify/library-builder": "^1.0.2", | ||
"@types/jest": "^27.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.31.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-jasmine": "^4.1.2", | ||
"jasmine": "^3.9.0", | ||
"jest": "^27.2.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^27.0.5", | ||
"typescript": "^4.4.3" | ||
} | ||
} |
{ | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./lib", | ||
"target": "ES2019", | ||
"module": "commonjs", | ||
"module": "CommonJS", | ||
"declaration": true, | ||
@@ -6,0 +8,0 @@ "declarationMap": false, |
{ | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./src/tsconfig.json" | ||
}, | ||
{ | ||
"path": "./tests/tsconfig.json" | ||
} | ||
] | ||
"extends": "./tsconfig-base.json", | ||
"include": ["src/**/*.ts", ".eslintrc.js"], | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./lib" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
133949
75
4900
11
2
1
Updated@iconify/types@^1.0.7