mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-01 21:59:30 +08:00
29 lines
669 B
Text
29 lines
669 B
Text
import { iconDefaults } from './index.mjs';
|
|
|
|
function mergeIconData(icon, alias) {
|
|
const result = { ...icon };
|
|
for (const key in iconDefaults) {
|
|
const prop = key;
|
|
if (alias[prop] !== void 0) {
|
|
const value = alias[prop];
|
|
if (result[prop] === void 0) {
|
|
result[prop] = value;
|
|
continue;
|
|
}
|
|
switch (prop) {
|
|
case "rotate":
|
|
result[prop] = (result[prop] + value) % 4;
|
|
break;
|
|
case "hFlip":
|
|
case "vFlip":
|
|
result[prop] = value !== result[prop];
|
|
break;
|
|
default:
|
|
result[prop] = value;
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
export { mergeIconData };
|