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

hash-sum

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash-sum - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

hash-sum.js

@@ -26,3 +26,3 @@ 'use strict';

function foldObject (hash, o, seen) {
return Object.keys(o).reduce(foldKey, hash);
return Object.keys(o).sort().reduce(foldKey, hash);
function foldKey (hash, key) {

@@ -29,0 +29,0 @@ return foldValue(hash, o[key], key, seen);

{
"name": "hash-sum",
"description": "Blazing fast unique hash generator",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/bevacqua/hash-sum",

@@ -6,0 +6,0 @@ "authors": [

@@ -11,2 +11,12 @@ # hash-sum

# features
- no dependencies
- minimal footprint
- works in all of node.js, io.js, and the browser
- hashes functions based on their source code
- produces different hashes for different object types
- support for circular references in objects
- ignores property assignment order
# `sum(value)`

@@ -50,3 +60,2 @@

3718c6e8 from: { a: {}, b: {} }
caec4ca8 from: { b: {}, a: {} }
5d844489 from: []

@@ -53,0 +62,0 @@ 938eaaf0 from: Tue Jul 14 2015 15:35:36 GMT-0300 (ART)

@@ -5,6 +5,6 @@ 'use strict';

var test = require('tape');
var results = [];
var sum = require('./');
test('creates unique hashes', function (t) {
var sum = require('./');
var results = [];
sub([0,1,2,3]);

@@ -41,3 +41,2 @@ sub({url:12});

sub({a:{},b:{}});
sub({b:{},a:{}});
sub([]);

@@ -55,1 +54,11 @@ sub(new Date());

});
test('hashes clash if same properties', function (t) {
equals({a:'1'},{a:'1'});
equals({a:'1',b:1},{b:1,a:'1'});
t.end();
function equals (a, b) {
t.equal(sum(a), sum(b));
}
});

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