You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

dereference-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dereference-json-schema - npm Package Compare versions

Comparing version
0.2.1
to
0.2.2
+4
-1
klona.d.ts

@@ -5,3 +5,6 @@ /**

* https://github.com/lukeed/klona/blob/master/license
*
* Extended with circular reference tracking to support
* dereferenced OpenAPI schemas that contain self-referencing types.
*/
export declare function klona<T>(val: T): T;
export declare function klona<T>(val: T, seen?: Map<unknown, unknown>): T;
+12
-4

@@ -5,2 +5,5 @@ /**

* https://github.com/lukeed/klona/blob/master/license
*
* Extended with circular reference tracking to support
* dereferenced OpenAPI schemas that contain self-referencing types.
*/ "use strict";

@@ -16,15 +19,20 @@ Object.defineProperty(exports, "__esModule", {

});
function klona(val) {
function klona(val, seen) {
if (!seen) seen = new Map();
var index, out, tmp;
if (Array.isArray(val)) {
if (seen.has(val)) return seen.get(val);
out = Array(index = val.length);
while(index--)out[index] = (tmp = val[index]) && typeof tmp === "object" ? klona(tmp) : tmp;
seen.set(val, out);
while(index--)out[index] = (tmp = val[index]) && typeof tmp === "object" ? klona(tmp, seen) : tmp;
return out;
}
if (Object.prototype.toString.call(val) === "[object Object]") {
if (seen.has(val)) return seen.get(val);
out = {}; // null
seen.set(val, out);
for(index in val){
if (index === "__proto__") {
Object.defineProperty(out, index, {
value: klona(val[index]),
value: klona(val[index], seen),
configurable: true,

@@ -35,3 +43,3 @@ enumerable: true,

} else {
out[index] = (tmp = val[index]) && typeof tmp === "object" ? klona(tmp) : tmp;
out[index] = (tmp = val[index]) && typeof tmp === "object" ? klona(tmp, seen) : tmp;
}

@@ -38,0 +46,0 @@ }

{
"name": "dereference-json-schema",
"version": "0.2.1",
"version": "0.2.2",
"description": "Dereference $ref pointers in JSONSchema or OpenAPI documents.",

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