Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ohash

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ohash - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

dist/index.d.cts

69

dist/index.d.ts
interface HashOptions {
/**
*
* Function to determine if a key should be excluded from hashing.
* @optional
* @param key - The key to check for exclusion.
* @returns {boolean} - Returns true to exclude the key from hashing.
*/
excludeKeys?: ((key: string) => boolean) | undefined;
/**
* hash object keys, values ignored
* Specifies whether to exclude values from hashing, so that only the object keys are hashed.
* @optional
*/
excludeValues?: boolean | undefined;
/**
* ignore unknown object types
* Specifies whether to ignore objects of unknown type (not directly serialisable) when hashing.
* @optional
* @default false
*/
ignoreUnknown?: boolean | undefined;
/**
* optional function that replaces values before hashing
* A function that replaces values before they are hashed, which can be used to customise the hashing process.
* @optional
* @param value - The current value to be hashed.
* @returns {any} - The value to use for hashing instead.
*/
replacer?: ((value: any) => any) | undefined;
/**
* consider 'name' property of functions for hashing
* Specifies whether the 'name' property of functions should be taken into account when hashing.
* @optional
* @default false
*/
respectFunctionNames?: boolean | undefined;
/**
* consider function properties when hashing
* Specifies whether properties of functions should be taken into account when hashing.
* @optional
* @default false
*/
respectFunctionProperties?: boolean | undefined;
/**
* Respect special properties (prototype, letructor) when hashing to distinguish between types
* Specifies whether to include type-specific properties such as prototype or constructor in the hash to distinguish between types.
* @optional
* @default false
*/
respectType?: boolean | undefined;
/**
* Sort all arrays before hashing
* Specifies whether arrays should be sorted before hashing to ensure consistent order.
* @optional
* @default false
*/
unorderedArrays?: boolean | undefined;
/**
* Sort `Set` and `Map` instances before hashing
* Specifies whether Set and Map instances should be sorted by key before hashing to ensure consistent order.
* @optional
* @default true
*/
unorderedObjects?: boolean | undefined;
/**
* Sort `Set` and `Map` instances before hashing
* Specifies whether the elements of `Set' and keys of `Map' should be sorted before hashing to ensure consistent order.
* @optional
* @default false
*/

@@ -46,3 +67,3 @@ unorderedSets?: boolean | undefined;

* @param {object} object value to hash
* @param {HashOptions} options hashing options
* @param {HashOptions} options hashing options. See {@link HashOptions}.
* @return {string} serialized value

@@ -56,3 +77,3 @@ * @api public

* @param {object} object value to hash
* @param {HashOptions} options hashing options
* @param {HashOptions} options hashing options. See {@link HashOptions}.
* @return {string} hash value

@@ -66,3 +87,3 @@ * @api public

*
* @param {Uint8Array | string} key ASCII only
* @param {Uint8Array | string} key
* @param {number} seed Positive integer only

@@ -73,3 +94,15 @@ * @return {number} 32-bit positive integer hash

/**
* Calculates the SHA-256 hash of the message provided.
*
* @param {string} message - The message to hash.
* @returns {string} The message hash as a hexadecimal string.
*/
declare function sha256(message: string): string;
/**
* Calculates the SHA-256 hash of the given message and encodes it in Base64.
*
* @param {string} message - The message to hash.
* @returns {string} The base64 encoded hash of the message.
*/
declare function sha256base64(message: string): string;

@@ -81,3 +114,3 @@

* @param {any} object2 Second object
* @param {HashOptions} hash options
* @param {HashOptions} hashOptions. Configuration options for hashing the objects. See {@link HashOptions}.
* @return {boolean} true if equal and false if not

@@ -88,2 +121,10 @@ * @api public

/**
* Calculates the difference between two objects and returns a list of differences.
*
* @param {any} obj1 - The first object to compare.
* @param {any} obj2 - The second object to compare.
* @param {HashOptions} [opts={}] - Configuration options for hashing the objects. See {@link HashOptions}.
* @returns {DiffEntry[]} An array with the differences between the two objects.
*/
declare function diff(obj1: any, obj2: any, opts?: HashOptions): DiffEntry[];

@@ -90,0 +131,0 @@ declare class DiffEntry {

{
"name": "ohash",
"version": "1.1.3",
"version": "1.1.4",
"description": "Super fast hashing library based on murmurhash3 written in Vanilla JS",

@@ -23,19 +23,18 @@ "repository": "unjs/ohash",

"devDependencies": {
"@types/node": "^20.4.9",
"@vitest/coverage-v8": "^0.34.1",
"@types/node": "^22.5.5",
"@vitest/coverage-v8": "^2.1.1",
"benchmark": "^2.1.4",
"changelogen": "^0.5.4",
"eslint": "^8.46.0",
"eslint-config-unjs": "^0.2.1",
"prettier": "^3.0.1",
"typescript": "^5.1.6",
"unbuild": "^1.2.1",
"vitest": "^0.34.1"
"changelogen": "^0.5.5",
"eslint": "^9.10.0",
"eslint-config-unjs": "^0.3.2",
"prettier": "^3.3.3",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"vitest": "^2.1.1"
},
"packageManager": "pnpm@8.6.12",
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
"lint:fix": "eslint --fix --ext .ts,.js,.mjs,.cjs . && prettier -w src test",
"lint": "eslint . && prettier -c src test",
"lint:fix": "eslint --fix . && prettier -w src test",
"release": "pnpm test && changelogen --release --push && pnpm publish",

@@ -42,0 +41,0 @@ "benchmark": "node benchmark/object-hash.mjs",

@@ -113,3 +113,3 @@ # ohash

Converts input string (of any length) into a 32-bit positive integer using [MurmurHash3](<(https://en.wikipedia.org/wiki/MurmurHash)>).
Converts input string (of any length) into a 32-bit positive integer using [MurmurHash3](https://en.wikipedia.org/wiki/MurmurHash).

@@ -121,3 +121,3 @@ Usage:

// "2708020327"
// "427197390"
console.log(murmurHash("Hello World"));

@@ -161,3 +161,3 @@ ```

Based on [puleos/object-hash](https://github.com/puleos/object-hash) by [Scott Puleo](https://github.com/puleos/), and implementations from [perezd/node-murmurhash](perezd/node-murmurhash) and
Based on [puleos/object-hash](https://github.com/puleos/object-hash) by [Scott Puleo](https://github.com/puleos/), and implementations from [perezd/node-murmurhash](https://github.com/perezd/node-murmurhash) and
[garycourt/murmurhash-js](https://github.com/garycourt/murmurhash-js) by [Gary Court](mailto:gary.court@gmail.com) and [Austin Appleby](mailto:aappleby@gmail.com) and [brix/crypto-js](https://github.com/brix/crypto-js).

@@ -171,3 +171,3 @@

[npm-downloads-href]: https://npmjs.com/package/ohash
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/ohash/ci/main?style=flat-square
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/ohash/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/unjs/ohash/actions?query=workflow%3Aci

@@ -174,0 +174,0 @@ [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/ohash/main?style=flat-square

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc