PageSourceSearch

https://pressthink.org/j/rosen-archive/frontend/utils/needsReview.js?v=3.8.36

js pressthink.org collected 2026-10-02 04:26:17 UTC 1,024 bytes, 19 lines download raw bytes

1// Pure predicate for the "needs review" flag (#350).
2//
3// A record is auto-published but flagged for a human pass when its needsReview
4// field is set. The field's type is not stable across the data pipeline: the
5// committed JSON stores a boolean, while data/export-archive-data.js coerces it
6// with .toString() (a string) on regeneration. No flagged record reaches
7// production yet, so the marker must read both shapes or it would silently stop
8// rendering the day the JSON is regenerated. Accept boolean true and the string
9// 'true' (trimmed, case-insensitive); treat everything else — false, '', a
10// truthy non-true value, an absent field, null — as not flagged. Normalising the
11// field to one type upstream is tracked in #356.
12export function recordNeedsReview(record) {
13  const value = record == null ? undefined : record.needsReview;
14  if (value === true) return true;
15  if (typeof value === 'string') return value.trim().toLowerCase() === 'true';
16  return false;
17}
18
19export default { recordNeedsReview };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.