UNPKG

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