mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 21:53:51 +00:00
refactor(kernel): migrate the remaining SHA-256 hex digests to sha256Hex and move isRecord into src/kernel (#11571)
* refactor(kernel): migrate the remaining one-shot SHA-256 hex digests to sha256Hex * refactor(kernel): move isRecord into src/kernel and replace its inline copies (#11574) * fix(scripts): import isRecord from src/kernel in the managed manifest parser
This commit is contained in:
1 parent
9ecfb109e8
commit
b51ed4c3ec
157 files changed
+397
-589
No files matched your search
@@ -25,6 +25,7 @@ import { Formatter } from "incur";
|
||||
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import { isRecord } from "../kernel/isRecord.js";
|
||||
|
||||
export interface CliDelimitedOutputOptions {
|
||||
readonly fields: readonly string[];
|
||||
@@ -268,9 +269,7 @@ const isPlainObjectArray = (
|
||||
Array.isArray(value) &&
|
||||
value.every(
|
||||
(row: unknown) =>
|
||||
typeof row === "object" &&
|
||||
row !== null &&
|
||||
!Array.isArray(row) &&
|
||||
isRecord(row) &&
|
||||
(Object.getPrototypeOf(row) === Object.prototype ||
|
||||
Object.getPrototypeOf(row) === null),
|
||||
);
|
||||
@@ -284,9 +283,7 @@ const isFlatObject = (value: Record<string, unknown>): boolean =>
|
||||
const isObjectArray = (value: unknown): value is Record<string, unknown>[] =>
|
||||
Array.isArray(value) &&
|
||||
value.length > 0 &&
|
||||
value.every(
|
||||
(item) => typeof item === "object" && item !== null && !Array.isArray(item),
|
||||
) &&
|
||||
value.every((item) => isRecord(item)) &&
|
||||
value.some((item) => Object.keys(item).length > 0);
|
||||
|
||||
const isWordCharacter = (character: string | undefined): boolean =>
|
||||
@@ -467,11 +464,7 @@ const formatMarkdown = (
|
||||
if (isScalar(child))
|
||||
return `${heading}${escapeMarkdownText(String(child))}`;
|
||||
if (isObjectArray(child)) return `${heading}${formatObjectTable(child)}`;
|
||||
if (
|
||||
typeof child === "object" &&
|
||||
child !== null &&
|
||||
!Array.isArray(child)
|
||||
) {
|
||||
if (isRecord(child)) {
|
||||
const nested = child as Record<string, unknown>;
|
||||
return isFlatObject(nested)
|
||||
? `${heading}${formatKeyValueTable(nested)}`
|
||||
|
||||
Reference in new issue
Block a user