Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
object-code
Advanced tools
Blazing fast hash code generator that supports every possible javascript value.
object-code
is a blazing fast hash code generator that supports every possible javascript value.npm install --save object-code
# or
yarn add object-code
const { hashCode } = require('object-code');
// or
import { hashCode } from 'object-code';
<!-- Replace latest with the desired version -->
<script
crossorigin
src="https://cdn.jsdelivr.net/npm/object-code@latest/index.min.js"
></script>
<!-- or -->
<script crossorigin src="https://unpkg.com/object-code@latest/index.min.js"></script>
const { hashCode } = window.objectCode;
Fast hash is an blazing fast object hash code generator. It generates unique hashes for objects, arrays, functions, symbols and etc.
You can use it to index objects in a object/array/map/set, to compare objects or to just generate unique ids.
import { hashCode } from 'object-code';
const myWeirdObject = {
name: 'Arthur',
age: 20,
address: {
private: true
},
sayHello: function () {
console.log('Hello!');
},
id: Symbol('arthur'),
birth: new Date(1990, 1, 1),
tags: ['person', 'male', 'programmer']
// etc
};
const hash = hashCode(myWeirdObject);
// 1230491235
See all unique values at test/values.ts
This library is always seeking an faster implementation, doesn't matter if the hash code will change.
You shouldn't rely on cross version compatibility, and even if so, run some tests before upgrading.
I'll make an note on hash generation changes.
Simple benchmark with object-hash
and this package.
# node dist/benchmark.js
Number of generated hashes per second
Total of 100000 runs
Object tests:
0: object-code -> 35,984 runs/s
1: object-hash -> 11,307 runs/s
Json tests:
0: object-code -> 571,429 runs/s
1: object-hash -> 218,341 runs/s
Raw string tests:
0: object-code -> 3,448,276 runs/s
1: object-hash -> 251,192 runs/s
Licensed under the MIT. See LICENSE
for more informations.
See my contact information on my github profile or open a new issue.
FAQs
A blazing fast hash code generator that supports every possible javascript value.
The npm package object-code receives a total of 51,272 weekly downloads. As such, object-code popularity was classified as popular.
We found that object-code demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.