Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

hash-fns

ehmpathy17MIT1.0.1TypeScript support: included

easily create, assess, and assure hashes within a pit-of-success

hash, pit-of-success, domain-glossary, sha256

readme

hash-fns

test publish

easily create, assess, and assure hashes within a pit-of-success

install

npm install hash-fns

use

for example

import { Hash, toHashSha256, isHashSha256 } from 'hash-fns';

// create a hash
const versionHash: Hash = await toHashSha256('some data');

// verify that a given value is a valid hash
const foundHash: Hash = isHashSha256.assure('__hash__');

// typeguard against random strings being passed as hashes
const expectHash: Hash = 'some string'; // 🛑 typescript will throw an error, since string is not assignable to Hash

// use a hash within functions that expect strings
const expectWords: string = await toHashSha256('some data'); // ✅ passes, as Hash is assignable to strings

changelog

Changelog

1.0.1 (2024-08-05)

Bug Fixes

  • pkg: remove remaining procedure-fns references (3246e90)

1.0.0 (2024-08-05)

Features

  • init: initialize based on procedure-fns (b83a09c)