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

@medusajs/utils

Package Overview
Dependencies
Maintainers
2
Versions
2833
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@medusajs/utils - npm Package Compare versions

Comparing version 1.9.1-snapshot-20230608104224 to 1.9.1-snapshot-20230608182927

2

dist/common/stringify-circular.d.ts

@@ -1,1 +0,1 @@

export declare function stringifyCircular(object: any, space?: string | number): string;
export declare function stringifyCircular(object: any, replacer?: Function | null, space?: number): string;
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,28 +13,41 @@ exports.stringifyCircular = void 0;

};
var toPointer = function (parts) {
return "#" +
parts
.map(function (part) { return String(part).replace(/~/g, "~0").replace(/\//g, "~1"); })
.join("/");
var isPrimitive = function (val) {
return val !== Object(val);
};
var decycle = function () {
var paths = new WeakMap();
return function replacer(key, value) {
var _a;
if (key !== "$ref" && isObject(value)) {
var seen = paths.has(value);
if (seen) {
return { $ref: toPointer(paths.get(value)) };
function decycle(object, replacer) {
var objects = new WeakMap();
function deepCopy(value, path) {
var oldPath;
var newObj;
if (replacer != null) {
value = replacer(value);
}
if (isObject(value)) {
oldPath = objects.get(value);
if (oldPath !== undefined) {
return { $ref: oldPath };
}
objects.set(value, path);
if (Array.isArray(value)) {
newObj = [];
value.forEach(function (el, idx) {
newObj[idx] = deepCopy(el, path + "[" + idx + "]");
});
}
else {
paths.set(value, __spreadArray(__spreadArray([], ((_a = paths.get(this)) !== null && _a !== void 0 ? _a : []), true), [key], false));
newObj = {};
Object.keys(value).forEach(function (name) {
newObj[name] = deepCopy(value[name], path + "[" + JSON.stringify(name) + "]");
});
}
return newObj;
}
return value;
};
};
function stringifyCircular(object, space) {
return JSON.stringify(object, decycle(), space);
return !isPrimitive(value) ? value + "" : value;
}
return deepCopy(object, "$");
}
function stringifyCircular(object, replacer, space) {
return JSON.stringify(decycle(object, replacer), null, space);
}
exports.stringifyCircular = stringifyCircular;
//# sourceMappingURL=stringify-circular.js.map
{
"name": "@medusajs/utils",
"version": "1.9.1-snapshot-20230608104224",
"version": "1.9.1-snapshot-20230608182927",
"description": "Medusa utilities functions shared by Medusa core and Modules",

@@ -20,3 +20,3 @@ "main": "dist/index.js",

"devDependencies": {
"@medusajs/types": "1.8.8-snapshot-20230608104224",
"@medusajs/types": "1.8.8-snapshot-20230608182927",
"@types/express": "^4.17.17",

@@ -23,0 +23,0 @@ "cross-env": "^5.2.1",

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