UNPKG

1.35 kBJavaScriptView Raw
1import { a as _objectSpread } from './chunk-1f79df9b.js';
2
3function parseIcons(icons, _temp) {
4 var _ref = _temp === void 0 ? {} : _temp,
5 prefix = _ref.prefix,
6 type = _ref.type;
7
8 if (type === 'font-awesome') {
9 var parsedIcons = icons.reduce(function (newIcons, _ref2) {
10 var _objectSpread2;
11
12 var iconName = _ref2.iconName,
13 iconDetails = _ref2.icon;
14 if (!iconDetails) return newIcons;
15 return _objectSpread({}, newIcons, (_objectSpread2 = {}, _objectSpread2["" + (prefix || '') + iconName] = {
16 viewBoxWidth: iconDetails[0],
17 viewBoxHeight: iconDetails[1],
18 paths: [iconDetails[4]]
19 }, _objectSpread2));
20 }, {});
21 return parsedIcons;
22 }
23
24 if (type === 'font-awesome-standalone') {
25 var _parsedIcons = icons.reduce(function (newIcons, _ref3) {
26 var _objectSpread3;
27
28 var iconName = _ref3.iconName,
29 height = _ref3.height,
30 width = _ref3.width,
31 svgPathData = _ref3.svgPathData;
32 if (!iconName) return newIcons;
33 return _objectSpread({}, newIcons, (_objectSpread3 = {}, _objectSpread3["" + (prefix || '') + iconName] = {
34 viewBoxWidth: width,
35 viewBoxHeight: height,
36 paths: [svgPathData]
37 }, _objectSpread3));
38 }, {});
39
40 return _parsedIcons;
41 }
42
43 return {};
44}
45
46export default parseIcons;