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

reference-map

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

reference-map - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

8

index.js

@@ -6,2 +6,3 @@ module.exports = class ReferanceMap {

constructor () {
this.intRefProp = Symbol('int')
this._map = []

@@ -18,3 +19,8 @@ }

add (obj, type) {
return this._map.push({obj, type}) - 1
let ref = obj[this.intRefProp]
if (ref === undefined) {
ref = this._map.push({obj, type}) - 1
obj[this.intRefProp] = ref
}
return ref
}

@@ -21,0 +27,0 @@

2

package.json
{
"name": "reference-map",
"version": "1.2.0",
"version": "1.2.1",
"description": "This is a simple determinstic map that maps POJOs to an integer",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ const tape = require('tape')

tape('referance mapping', t => {
t.plan(11)
t.plan(12)
const referanceMap = new ReferanceMap()

@@ -25,2 +25,6 @@ const obj1 = {}

const dupRef = referanceMap.add(obj2)
t.equals(dupRef, ref2, 'detect duplicate refs')
referanceMap.delete(ref1)

@@ -27,0 +31,0 @@ try {

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