🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-object-hash

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-object-hash

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

3.1.1
latest
Source
npm
Version published
Weekly downloads
957K
-12.06%
Maintainers
1
Weekly downloads
 
Created

What is node-object-hash?

The node-object-hash package is a utility for creating consistent hash values from JavaScript objects. It is useful for tasks such as caching, object comparison, and ensuring data integrity.

What are node-object-hash's main functionalities?

Hashing Objects

This feature allows you to create a hash from a JavaScript object. The hash can be used to uniquely identify the object.

const objectHash = require('node-object-hash');
const hasher = objectHash();
const obj = { name: 'John', age: 30 };
const hash = hasher.hash(obj);
console.log(hash);

Custom Hashing Options

This feature allows you to customize the hashing process by specifying options such as coercion and the hashing algorithm.

const objectHash = require('node-object-hash');
const hasher = objectHash({ coerce: true, alg: 'sha256' });
const obj = { name: 'John', age: 30 };
const hash = hasher.hash(obj);
console.log(hash);

Hashing Arrays

This feature allows you to create a hash from an array, ensuring that the array's contents are uniquely identified.

const objectHash = require('node-object-hash');
const hasher = objectHash();
const arr = [1, 2, 3, 4];
const hash = hasher.hash(arr);
console.log(hash);

Other packages similar to node-object-hash

Keywords

hash

FAQs

Package last updated on 17 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts