New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@jsonhero/parser

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonhero/parser - npm Package Compare versions

Comparing version
1.0.8
to
1.0.9
+0
-36
lib/index.js

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

var jsonInferTypes = require('@jsonhero/json-infer-types');
var wildcardPathComponent = require('@jsonhero/path/lib/path/wildcard-path-component');

@@ -57,3 +56,2 @@ function friendlyName(name) {

buildValueTree(object, rootPath, 'Root', parsedObject.values.values);
buildStructureTree(object, rootPath, 'Root', parsedObject.structure.values);
return parsedObject;

@@ -87,36 +85,2 @@ }

}
function buildStructureTree(rootObject, path$1, name, structureCollection) {
var heroPath = new path.JSONHeroPath(path$1);
var results = heroPath.all(rootObject);
heroPath.components[heroPath.components.length - 1] instanceof wildcardPathComponent.WildcardPathComponent;
var structureInfo = {
path: path$1,
name: name,
displayName: friendlyName(name),
type: jsonInferTypes.inferType(results[0]),
children: null,
};
structureCollection[path$1] = structureInfo;
results.forEach(function (result) {
if (isCollection(structureInfo.type)) {
var parentPath = new path.JSONHeroPath(path$1);
structureInfo.children = [];
if (structureInfo.type.name === 'array') {
var arrayChildPath = parentPath.child('*').toString();
if (!structureInfo.children.includes(arrayChildPath)) {
structureInfo.children.push(arrayChildPath);
}
buildStructureTree(rootObject, arrayChildPath, name, structureCollection);
}
else {
for (var key in result) {
result[key];
var childPath = parentPath.child(key).toString();
structureInfo.children.push(childPath);
buildStructureTree(rootObject, childPath, key, structureCollection);
}
}
}
});
}
function isCollection(type) {

@@ -123,0 +87,0 @@ return type.name === 'array' || type.name === 'object';

import { JSONHeroPath } from '@jsonhero/path';
import { inferType } from '@jsonhero/json-infer-types';
import { WildcardPathComponent } from '@jsonhero/path/lib/path/wildcard-path-component';

@@ -52,3 +51,2 @@ function friendlyName(name) {

buildValueTree(object, rootPath, 'Root', parsedObject.values.values);
buildStructureTree(object, rootPath, 'Root', parsedObject.structure.values);
return parsedObject;

@@ -82,36 +80,2 @@ }

}
function buildStructureTree(rootObject, path, name, structureCollection) {
var heroPath = new JSONHeroPath(path);
var results = heroPath.all(rootObject);
heroPath.components[heroPath.components.length - 1] instanceof WildcardPathComponent;
var structureInfo = {
path: path,
name: name,
displayName: friendlyName(name),
type: inferType(results[0]),
children: null,
};
structureCollection[path] = structureInfo;
results.forEach(function (result) {
if (isCollection(structureInfo.type)) {
var parentPath = new JSONHeroPath(path);
structureInfo.children = [];
if (structureInfo.type.name === 'array') {
var arrayChildPath = parentPath.child('*').toString();
if (!structureInfo.children.includes(arrayChildPath)) {
structureInfo.children.push(arrayChildPath);
}
buildStructureTree(rootObject, arrayChildPath, name, structureCollection);
}
else {
for (var key in result) {
result[key];
var childPath = parentPath.child(key).toString();
structureInfo.children.push(childPath);
buildStructureTree(rootObject, childPath, key, structureCollection);
}
}
}
});
}
function isCollection(type) {

@@ -118,0 +82,0 @@ return type.name === 'array' || type.name === 'object';

+1
-1
{
"name": "@jsonhero/parser",
"version": "1.0.8",
"version": "1.0.9",
"description": "A parser that walks through a JSON file and for each value determines the path to it, the type and paths to any children. It also builds a model of the structure of the data.",

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