fixup
This commit is contained in:
parent
74cd5536af
commit
165732d7cd
|
@ -1,6 +1,6 @@
|
||||||
import Debug from "debug";
|
import Debug from "debug";
|
||||||
import {Lossless, LosslessViewMany} from "../src/lossless";
|
import {Lossless, LosslessViewMany} from "../src/lossless";
|
||||||
import {Lossy, firstValueFromLosslessViewOne, firstValueFromCollapsedDelta} from "../src/lossy";
|
import {Lossy, firstValueFromLosslessViewOne, valueFromCollapsedDelta} from "../src/lossy";
|
||||||
const debug = Debug('test:lossy');
|
const debug = Debug('test:lossy');
|
||||||
|
|
||||||
describe('Lossy', () => {
|
describe('Lossy', () => {
|
||||||
|
@ -53,7 +53,7 @@ describe('Lossy', () => {
|
||||||
const {delta, value: actor} = firstValueFromLosslessViewOne(ent, "actor") ?? {};
|
const {delta, value: actor} = firstValueFromLosslessViewOne(ent, "actor") ?? {};
|
||||||
if (!delta) continue; // TODO: panic
|
if (!delta) continue; // TODO: panic
|
||||||
if (!actor) continue; // TODO: panic
|
if (!actor) continue; // TODO: panic
|
||||||
const film = firstValueFromCollapsedDelta(delta, "film");
|
const film = valueFromCollapsedDelta(delta, "film");
|
||||||
debug(`role ${id}`, {actor, film});
|
debug(`role ${id}`, {actor, film});
|
||||||
if (!film) continue; // TODO: panic
|
if (!film) continue; // TODO: panic
|
||||||
roles.push({
|
roles.push({
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function valueFromCollapsedDelta(delta: CollapsedDelta, key: string): str
|
||||||
// Example function for resolving a value for an entity by taking the first value we find
|
// Example function for resolving a value for an entity by taking the first value we find
|
||||||
export function firstValueFromLosslessViewOne(ent: LosslessViewOne, key: string): {delta: CollapsedDelta, value: string} | undefined {
|
export function firstValueFromLosslessViewOne(ent: LosslessViewOne, key: string): {delta: CollapsedDelta, value: string} | undefined {
|
||||||
for (const delta of ent.properties[key] || []) {
|
for (const delta of ent.properties[key] || []) {
|
||||||
const value = firstValueFromCollapsedDelta(delta, key);
|
const value = valueFromCollapsedDelta(delta, key);
|
||||||
if (value) return {delta, value};
|
if (value) return {delta, value};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue