@aliceplex/core
Version:
[![License][license_badge]][license] [![Pipelines][pipelines_badge]][pipelines] [![Coverage][coverage_badge]][pipelines] [![NPM][npm_badge]][npm] [![semantic-release][semantic_release_badge]][semantic_release]
37 lines • 1.81 kB
JavaScript
;
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/camelcase */
const format_1 = require("../format");
exports.isArtist = (model) => "similar" in model;
exports.isSerializedArtist = (model) => "similar" in model;
const sort = ({ sort_title, genres, collections, summary, similar }) => ({
sort_title,
genres,
collections,
summary,
similar
});
exports.serializeArtist = (data) => {
const { sortTitle: sort_title } = data, others = __rest(data, ["sortTitle"]);
return sort(Object.assign({ sort_title }, others));
};
exports.deserializeArtist = (data) => {
const { sort_title: sortTitle } = data, others = __rest(data, ["sort_title"]);
return Object.assign({ sortTitle }, others);
};
exports.normalizeArtist = (data) => {
const { genres, collections, similar, summary, sortTitle } = data, others = __rest(data, ["genres", "collections", "similar", "summary", "sortTitle"]);
return Object.assign(Object.assign({}, others), { sortTitle: sortTitle ? format_1.normalize(sortTitle) : sortTitle, summary: summary ? format_1.normalize(summary) : summary, genres: genres.map(format_1.normalize), similar: similar.map(format_1.normalize), collections: collections.map(format_1.normalize) });
};
//# sourceMappingURL=artist.js.map