mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-20 17:49:13 +08:00
42 lines
1.2 KiB
Text
42 lines
1.2 KiB
Text
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
const icon_index = require('../icon/index.cjs');
|
|
const icon_merge = require('../icon/merge.cjs');
|
|
|
|
function getIconData(data, name, full = false) {
|
|
function getIcon(name2, iteration) {
|
|
if (data.icons[name2] !== void 0) {
|
|
return Object.assign({}, data.icons[name2]);
|
|
}
|
|
if (iteration > 5) {
|
|
return null;
|
|
}
|
|
const aliases = data.aliases;
|
|
if (aliases && aliases[name2] !== void 0) {
|
|
const item = aliases[name2];
|
|
const result2 = getIcon(item.parent, iteration + 1);
|
|
if (result2) {
|
|
return icon_merge.mergeIconData(result2, item);
|
|
}
|
|
return result2;
|
|
}
|
|
const chars = data.chars;
|
|
if (!iteration && chars && chars[name2] !== void 0) {
|
|
return getIcon(chars[name2], iteration + 1);
|
|
}
|
|
return null;
|
|
}
|
|
const result = getIcon(name, 0);
|
|
if (result) {
|
|
for (const key in icon_index.iconDefaults) {
|
|
if (result[key] === void 0 && data[key] !== void 0) {
|
|
result[key] = data[key];
|
|
}
|
|
}
|
|
}
|
|
return result && full ? icon_index.fullIcon(result) : result;
|
|
}
|
|
|
|
exports.getIconData = getIconData;
|