mirror of
https://github.com/morluto/rea.git
synced 2026-10-28 02:15:44 +00:00
refactor(domain): reuse canonical ordering and digest owners
This commit is contained in:
1 parent
c537c52c96
commit
51be954c4b
6 files changed
+37
-55
No files matched your search
@@ -829,15 +829,6 @@ export const registrationKey = (
|
||||
]),
|
||||
]);
|
||||
|
||||
/** Sort values by a deterministic unique semantic key. */
|
||||
export const sortedUnique = <Value>(
|
||||
values: readonly Value[],
|
||||
key: (value: Value) => string,
|
||||
): Value[] =>
|
||||
[...new Map(values.map((value) => [key(value), value])).values()].sort(
|
||||
(left, right) => compareUnicodeCodePoints(key(left), key(right)),
|
||||
);
|
||||
|
||||
/** Hash exact UTF-8 source text. */
|
||||
export const sha256Text = (value: string): string =>
|
||||
createHash("sha256").update(value).digest("hex");
|
||||
|
||||
Reference in new issue
Block a user