Package Exports
- hash-fns
- hash-fns/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hash-fns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hash-fns
easily create, assess, and assure hashes within a pit-of-success
install
npm install hash-fnsuse
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