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

idea-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idea-toolbox - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

9

index.js

@@ -38,3 +38,7 @@ 'use strict';

function Obj2N(obj, maxDepth, currentDepth) {
if(!obj || typeof obj != 'object') return obj;
// stop the execution if obj is not an object (if it's a string, works as ES2N)
if(obj == null || obj == undefined) return null;
else if(typeof obj == 'string') return ES2N(obj);
else if(typeof obj != 'object') return obj;
// go deeper in the object
if(!maxDepth) maxDepth = 0;

@@ -46,3 +50,4 @@ if(!currentDepth) currentDepth = 0;

else if(typeof obj[prop] == 'object' && Array.isArray(obj[prop]) && currentDepth < maxDepth)
obj[prop].forEach(el => el = Obj2N(el, maxDepth, currentDepth+1));
obj[prop].forEach((el, index, arr) => arr[index] = Obj2N(el, maxDepth, currentDepth+1));
// a standard forEach won't work with elements different from objects (e.g. strings)
else if(typeof obj[prop] == 'object' && !Array.isArray(obj[prop]) && currentDepth < maxDepth)

@@ -49,0 +54,0 @@ obj[prop] = Obj2N(obj[prop], maxDepth, currentDepth+1);

{
"name": "idea-toolbox",
"version": "0.1.8",
"version": "0.1.9",
"description": "IDEA's utility functions",

@@ -5,0 +5,0 @@ "engines": {

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