@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.75 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.isAlbum = (model) => "aired" in model && !("actors" in model) && !("directors" in model);
exports.isSerializedAlbum = (model) => "aired" in model && !("actors" in model) && !("directors" in model);
const sort = ({ sort_title, aired, collections, genres, summary }) => ({
sort_title,
aired,
collections,
genres,
summary
});
exports.serializeAlbum = (data) => {
const { sortTitle: sort_title } = data, others = __rest(data, ["sortTitle"]);
return sort(Object.assign({ sort_title }, others));
};
exports.deserializeAlbum = (data) => {
const { sort_title: sortTitle } = data, others = __rest(data, ["sort_title"]);
return Object.assign({ sortTitle }, others);
};
exports.normalizeAlbum = (data) => {
const { genres, collections, summary } = data, others = __rest(data, ["genres", "collections", "summary"]);
return Object.assign(Object.assign({}, others), { summary: summary ? format_1.normalize(summary) : summary, genres: genres.map(format_1.normalize), collections: collections.map(format_1.normalize) });
};
//# sourceMappingURL=album.js.map