Comparing version 0.0.15 to 0.0.16
@@ -12,4 +12,3 @@ 'use strict'; | ||
payload: {}, | ||
seen: [], | ||
seenPaths: [], | ||
seen: new WeakMap(), | ||
identity: false, | ||
@@ -38,10 +37,8 @@ identityDetection: false | ||
state.path = (state.path ? state.path : '#') + escKey; | ||
let seenIndex = state.identityDetection ? state.seen.indexOf(object[key]) : -1; | ||
state.identity = (seenIndex >= 0); | ||
state.identityPath = (state.identity ? state.seenPaths[seenIndex] : undefined); | ||
state.identityPath = state.seen.get(object[key]); | ||
state.identity = (typeof state.identityPath !== 'undefined'); | ||
callback(object, key, state); | ||
if ((typeof object[key] === 'object') && (!state.identity)) { | ||
if (state.identityDetection && !Array.isArray(object[key])) { | ||
state.seen.push(object[key]); | ||
state.seenPaths.push(state.path); | ||
state.seen.set(object[key],state.path); | ||
} | ||
@@ -55,3 +52,2 @@ let newState = {}; | ||
newState.seen = state.seen; | ||
newState.seenPaths = state.seenPaths; | ||
newState.identity = false; | ||
@@ -58,0 +54,0 @@ newState.identityDetection = state.identityDetection; |
{ | ||
"name": "reftools", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Utility functions to deal with references in objects", | ||
@@ -5,0 +5,0 @@ "main": "lib/recurse.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35247
662