merkle-reference
Version:
This is a TS library implementing [merkle reference] specification.
22 lines (17 loc) • 394 B
JavaScript
import { toUTF8 } from './utf8.js'
/**
* @param {string} name
*/
export const fromString = (name) => Symbol.for(name)
/**
* @param {unknown} value
* @returns {value is symbol}
*/
export const is = (value) => typeof value === 'symbol'
/**
*
* @param {symbol} value
*/
export const toBytes = (value) =>
toUTF8(/** @type {string} */ (value.description))
export { fromString as for }