Skip to content

Refactor: move hash helper to util.js and extract metadata functions into metadataUtil.js - #284

Merged
albe merged 2 commits into
mainfrom
copilot/move-hash-helper-to-utils
Mar 30, 2026
Merged

Refactor: move hash helper to util.js and extract metadata functions into metadataUtil.js#284
albe merged 2 commits into
mainfrom
copilot/move-hash-helper-to-utils

Conversation

Copilot AI commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Consolidates the hash utility alongside other general helpers and separates metadata/matcher concerns into a dedicated module.

Changes

  • src/util.js — Added hash (DJB2, previously private to ReadablePartition); removed createHmac, matches, buildMetadataForMatcher, buildMatcherFromMetadata, and the crypto import.
  • src/metadataUtil.js (new) — Houses all metadata builder/matching functions: createHmac, matches, buildMetadataForMatcher, buildMatcherFromMetadata.
  • src/Partition/ReadablePartition.js — Drops local hash definition; imports hash from ../util.
  • src/Storage/ReadableStorage.js / src/Storage/WritableStorage.js — Updated imports to pull metadata functions from ../metadataUtil.
// Before: hash was a private function in ReadablePartition.js
// After:
const { hash } = require('../util');

// Before: metadata functions lived in util.js
// After:
const { createHmac, matches, buildMetadataForMatcher, buildMatcherFromMetadata } = require('../metadataUtil');

Copilot AI changed the title [WIP] Move hash helper function to utils and split metadata functions Refactor: move hash helper to util.js and extract metadata functions into metadataUtil.js Mar 30, 2026
Copilot AI requested a review from albe March 30, 2026 17:32
Copilot finished work on behalf of albe March 30, 2026 17:32
@albe
albe marked this pull request as ready for review March 30, 2026 17:38
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 98.121% (+0.002%) from 98.119%
when pulling c832a66 on copilot/move-hash-helper-to-utils
into 22c0088 on main.

@albe
albe merged commit 878abef into main Mar 30, 2026
10 checks passed
@albe
albe deleted the copilot/move-hash-helper-to-utils branch March 30, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants