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

@oclif/core

Package Overview
Dependencies
Maintainers
2
Versions
405
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core - npm Package Compare versions

Comparing version 4.0.27 to 4.0.28

1

lib/ux/colorize-json.d.ts

@@ -5,2 +5,3 @@ type Options = {

};
export declare function removeCycles(object: unknown): unknown;
export declare function tokenize(json?: unknown, options?: Options): {

@@ -7,0 +8,0 @@ type: string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeCycles = removeCycles;
exports.tokenize = tokenize;

@@ -18,2 +19,33 @@ exports.default = colorizeJson;

];
function removeCycles(object) {
// Keep track of seen objects.
const seenObjects = new WeakMap();
const _removeCycles = (obj) => {
// Use object prototype to get around type and null checks
if (Object.prototype.toString.call(obj) === '[object Object]') {
// We know it is a "Record<string, unknown>" because of the conditional
const dictionary = obj;
// Seen, return undefined to remove.
if (seenObjects.has(dictionary))
return;
seenObjects.set(dictionary, undefined);
for (const key in dictionary) {
// Delete the duplicate object if cycle found.
if (_removeCycles(dictionary[key]) === undefined) {
delete dictionary[key];
}
}
}
else if (Array.isArray(obj)) {
for (const i in obj) {
if (_removeCycles(obj[i]) === undefined) {
// We don't want to delete the array, but we can replace the element with null.
obj[i] = null;
}
}
}
return obj;
};
return _removeCycles(object);
}
function formatInput(json, options) {

@@ -27,3 +59,3 @@ return options?.pretty

function tokenize(json, options) {
let input = formatInput(json, options);
let input = formatInput(removeCycles(json), options);
const tokens = [];

@@ -30,0 +62,0 @@ let foundToken = false;

2

package.json
{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "4.0.27",
"version": "4.0.28",
"author": "Salesforce",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues",

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