Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import PropTypes from 'prop-types';
import React from 'react';
import { filters } from '@talend/icons/dist/react';
import { getIconHref as getIcon } from '@talend/icons/dist/info';
let talendIcons = {};
if (!process.env.ICON_BUNDLE) {
console.warn('WARNING ICON_BUNDLE will be the default in the next major release');
talendIcons = require('@talend/icons/dist/react').default;
}
const context = {
ids: [],
// default no op for testing (case of Icon call without IconsProvider)
get: () => {},
};
export function getIconHREF(name) {
if (context.ids.indexOf(name) !== -1) {
return `#${name}`;
}
let href = context.get(name);
if (!href) {
if (process.env.ICON_BUNDLE) {
href = getIcon(name);