From c94e04a46fbea7b444ca46636604e1d15930f5de Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 13 Jan 2025 11:11:11 +0100 Subject: [PATCH] chore: organize src dir --- src/{ => hash}/hash.ts | 2 +- src/{ => hash}/object-hash.ts | 0 src/index.ts | 13 +++++++++---- src/{ => utils}/diff.ts | 2 +- src/{utils.ts => utils/is-equal.ts} | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) rename src/{ => hash}/hash.ts (90%) rename src/{ => hash}/object-hash.ts (100%) rename src/{ => utils}/diff.ts (97%) rename src/{utils.ts => utils/is-equal.ts} (90%) diff --git a/src/hash.ts b/src/hash/hash.ts similarity index 90% rename from src/hash.ts rename to src/hash/hash.ts index b6a3186..199fb2d 100644 --- a/src/hash.ts +++ b/src/hash/hash.ts @@ -1,5 +1,5 @@ import { objectHash, HashOptions } from "./object-hash"; -import { sha256base64 } from "./crypto/sha256"; +import { sha256base64 } from "../crypto/sha256"; /** * Hash any JS value into a string diff --git a/src/object-hash.ts b/src/hash/object-hash.ts similarity index 100% rename from src/object-hash.ts rename to src/hash/object-hash.ts diff --git a/src/index.ts b/src/index.ts index bde8db8..3768d77 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,11 @@ -export { objectHash } from "./object-hash"; -export { hash } from "./hash"; +// Hash +export { objectHash } from "./hash/object-hash"; +export { hash } from "./hash/hash"; + +// Crypto export { murmurHash } from "./crypto/murmur"; export { sha256, sha256base64 } from "./crypto/sha256"; -export { isEqual } from "./utils"; -export { diff } from "./diff"; + +// Utils +export { isEqual } from "./utils/is-equal"; +export { diff } from "./utils/diff"; diff --git a/src/diff.ts b/src/utils/diff.ts similarity index 97% rename from src/diff.ts rename to src/utils/diff.ts index d0dc7a8..2f4928c 100644 --- a/src/diff.ts +++ b/src/utils/diff.ts @@ -1,4 +1,4 @@ -import { objectHash, HashOptions } from "./object-hash"; +import { objectHash, HashOptions } from "../hash/object-hash"; /** * Calculates the difference between two objects and returns a list of differences. diff --git a/src/utils.ts b/src/utils/is-equal.ts similarity index 90% rename from src/utils.ts rename to src/utils/is-equal.ts index 00be2fc..e8de138 100644 --- a/src/utils.ts +++ b/src/utils/is-equal.ts @@ -1,4 +1,4 @@ -import { objectHash, HashOptions } from "./object-hash"; +import { objectHash, HashOptions } from "../hash/object-hash"; /** * Compare two objects using reference equality and stable deep hashing. * @param {any} object1 First object