site/node_modules/@citation-js/name/lib/output.js

26 lines
793 B
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const startParts = ['dropping-particle', 'given'];
const suffixParts = ['suffix'];
const endParts = ['non-dropping-particle', 'family'];
const getName = function getName(name, reversed = false) {
const get = parts => parts.map(entry => name[entry] || '').filter(Boolean).join(' ');
if (name.literal) {
return name.literal;
} else if (reversed) {
const suffixPart = get(suffixParts) ? `, ${get(suffixParts)}` : '';
const startPart = get(startParts) ? `, ${get(startParts)}` : '';
return get(endParts) + suffixPart + startPart;
} else {
return `${get([...startParts, ...suffixParts, ...endParts])}`;
}
};
var _default = getName;
exports.default = _default;