Skip to content

Commit

Permalink
chore: remove unused utils (#852)
Browse files Browse the repository at this point in the history
`utils.js` exported `idToKey` and `parseVersion`, neither of which are
used anywhere. This removes them.
  • Loading branch information
EvanHahn authored Sep 19, 2024
1 parent 7b1828b commit f414bbd
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
import b4a from 'b4a'
import sodium from 'sodium-universal'
import { keyToPublicId } from '@mapeo/crypto'
import { createHash } from 'node:crypto'
import stableStringify from 'json-stable-stringify'

const PROJECT_INVITE_ID_SALT = Buffer.from('mapeo project invite id', 'ascii')

/**
* @param {String|Buffer} id
* @returns {Buffer | Uint8Array}
*/
export function idToKey(id) {
if (b4a.isBuffer(id)) {
return /** @type {Buffer} */ (id)
}

return b4a.from(/** @type {String} */ (id), 'hex')
}

/**
*
* @param {Buffer|String} key
Expand All @@ -31,18 +18,6 @@ export function keyToId(key) {
return key.toString('hex')
}

/**
* @param {String} version
* @returns {{coreId: String, blockIndex: Number}}
*/
export function parseVersion(version) {
const [coreId, blockIndex] = version.split('@')
return {
coreId,
blockIndex: Number(blockIndex),
}
}

export class ExhaustivenessError extends Error {
/** @param {never} value */
constructor(value) {
Expand Down

0 comments on commit f414bbd

Please sign in to comment.