Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@iconify/utils

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iconify/utils - npm Package Compare versions

Comparing version 1.0.15 to 1.0.16

13

lib/icon-set/parse.d.ts

@@ -5,10 +5,2 @@ import type { IconifyAlias, IconifyJSON } from '@iconify/types';

/**
* What to track when parsing icon set:
*
* none - do not track anything, return true on success
* valid - track valid icons, return list of valid icons on success
* all - track valid and missing icons, return full list on success
*/
export declare type ParseIconSetTracking = 'none' | 'valid' | 'all';
/**
* Which aliases to parse:

@@ -33,3 +25,2 @@ *

validate?: boolean | IconSetValidationOptions;
list?: ParseIconSetTracking;
aliases?: ParseIconSetAliases;

@@ -39,3 +30,5 @@ }

* Extract icons from an icon set
*
* Returns list of icons that were found in icon set
*/
export declare function parseIconSet(data: IconifyJSON, callback: SplitIconSetCallback, options?: ParseIconSetOptions): boolean | string[];
export declare function parseIconSet(data: IconifyJSON, callback: SplitIconSetCallback, options?: ParseIconSetOptions): string[];

@@ -21,9 +21,14 @@ "use strict";

* Extract icons from an icon set
*
* Returns list of icons that were found in icon set
*/
function parseIconSet(data, callback, options) {
options = options || {};
// List of icon names
const names = [];
// Options
options = options || {};
const list = options.list || 'none';
// Must be an object and must have 'icons' property
if (typeof data !== 'object' || typeof data.icons !== 'object') {
return names;
}
// Validate icon set
const validate = options.validate;

@@ -36,9 +41,5 @@ if (validate !== false) {

catch (err) {
return list === 'none' ? false : [];
return names;
}
}
// Must be an object
if (typeof data !== 'object') {
return list === 'none' ? false : names;
}
// Check for missing icons list returned by API

@@ -48,11 +49,5 @@ if (data.not_found instanceof Array) {

callback(name, null);
if (list === 'all') {
names.push(name);
}
names.push(name);
});
}
// Must have 'icons' object
if (typeof data.icons !== 'object') {
return list === 'none' ? false : names;
}
// Get icons

@@ -84,4 +79,4 @@ const icons = data.icons;

}
return list === 'none' ? names.length > 0 : names;
return names;
}
exports.parseIconSet = parseIconSet;

@@ -5,3 +5,3 @@ {

"author": "Vjacheslav Trushkin",
"version": "1.0.15",
"version": "1.0.16",
"license": "MIT",

@@ -8,0 +8,0 @@ "bugs": "https://github.com/iconify/iconify/issues",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc