Skip to the content

Capsid menu

app/lib/media-ref-key.mjs

11 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of media-ref-key.mjs
FunctionLinesComplexityCoveredCRAPMutation
mediaRefKey9 to 112100%OkCRAP 2Ok100%

Imports

It imports no other module of this repo. Imported by app/lib/editor/post-rows.server.ts.

Source

/**
 * NUL cannot occur in any part, so the join is unambiguous; a printable `|`
 * would collide ("a|b","c" vs "a","b|c") and silently drop a ref. Keep it an
 * escape: a literal NUL makes the file binary to git and invisible in editors.
 *
 * @param {{ mediaKey: string, form: string, detail: string | null }} ref
 * @returns {string}
 */
export function mediaRefKey(ref) {
  return `${ref.mediaKey}\u0000${ref.form}\u0000${ref.detail ?? ""}`;
}