sassdoc-plugin-localization
Version:
SassDoc plugin for Ignite UI SassDoc Theme to help with localization.
20 lines (19 loc) • 790 B
JavaScript
export function byGroupAndType(data) {
var _a, _b;
const result = Object.create(null);
for (const item of data) {
const group = (_a = item === null || item === void 0 ? void 0 : item.group) === null || _a === void 0 ? void 0 : _a[0];
const type = (_b = item === null || item === void 0 ? void 0 : item.context) === null || _b === void 0 ? void 0 : _b.type;
if (group === undefined || type === undefined) {
continue;
}
if (!Object.prototype.hasOwnProperty.call(result, group)) {
result[group] = Object.create(null);
}
if (!Object.prototype.hasOwnProperty.call(result[group], type)) {
result[group][type] = [];
}
result[group][type].push(item);
}
return result;
}