From 165732d7cda047257eec38201451c57731d53a32 Mon Sep 17 00:00:00 2001 From: Ladd Date: Mon, 23 Dec 2024 23:36:38 -0600 Subject: [PATCH] fixup --- __tests__/lossy.ts | 4 ++-- src/lossy.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/lossy.ts b/__tests__/lossy.ts index 0e3959b..e0c0b38 100644 --- a/__tests__/lossy.ts +++ b/__tests__/lossy.ts @@ -1,6 +1,6 @@ import Debug from "debug"; 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'); describe('Lossy', () => { @@ -53,7 +53,7 @@ describe('Lossy', () => { const {delta, value: actor} = firstValueFromLosslessViewOne(ent, "actor") ?? {}; if (!delta) continue; // TODO: panic if (!actor) continue; // TODO: panic - const film = firstValueFromCollapsedDelta(delta, "film"); + const film = valueFromCollapsedDelta(delta, "film"); debug(`role ${id}`, {actor, film}); if (!film) continue; // TODO: panic roles.push({ diff --git a/src/lossy.ts b/src/lossy.ts index 2a0b363..c590efd 100644 --- a/src/lossy.ts +++ b/src/lossy.ts @@ -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 export function firstValueFromLosslessViewOne(ent: LosslessViewOne, key: string): {delta: CollapsedDelta, value: string} | undefined { for (const delta of ent.properties[key] || []) { - const value = firstValueFromCollapsedDelta(delta, key); + const value = valueFromCollapsedDelta(delta, key); if (value) return {delta, value}; } }