node-object-hash

  • Version 2.3.10
  • Published
  • 80.2 kB
  • No dependencies
  • MIT license

Install

npm i node-object-hash
yarn add node-object-hash
pnpm add node-object-hash

Overview

Node.js object hash library with properties/arrays sorting to provide constant hashes

Index

Functions

function hasher

hasher: (options?: hasher.HasherOptions) => hasher.Hasher;
  • Hasher constructor

    Parameter options

    hasher options hasher instance

Interfaces

interface Hashable

interface Hashable {}
  • If object implements Hashable interface then value from toHash will be used for hash function. It means that the different objects with the function toHash that return the same value will have the same hash

property toHashableString

toHashableString: () => string;

    interface Hasher

    interface Hasher {}

      method hash

      hash: (object: Hashable | any, opts?: hasher.HasherOptions) => string;
      • Create hash of an object

        Parameter object

        source object

        Returns

        hash string of an object

      method sort

      sort: (object: any) => string;
      • Create sorted string from an object

        Parameter object

        source object

        Returns

        sorted string from an object

      method sortObject

      sortObject: (object: any) => string;
      • Create sorted string from an object

        Parameter object

        source object

        Returns

        sorted string from an object sort

      interface HasherOptions

      interface HasherOptions extends objectSorter.SorterOptions {}
      • Object hasher options

      property alg

      alg?: string;
      • Hash algorithm to use 'sha256'

      property enc

      enc?: BinaryToTextEncoding;
      • String encoding for hash 'hex'

      Package Files (1)

      Dependencies (0)

      No dependencies.

      Dev Dependencies (27)

      Peer Dependencies (0)

      No peer dependencies.

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/node-object-hash.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/node-object-hash)
      • HTML
        <a href="https://www.jsdocs.io/package/node-object-hash"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>