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

@hestia-earth/schema-convert

Package Overview
Dependencies
Maintainers
0
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hestia-earth/schema-convert - npm Package Compare versions

Comparing version 30.2.1 to 30.3.0

6

csv-pivot.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCsvPivot = exports.toCsv = void 0;
var json_2_csv_1 = require("json-2-csv");
var utils_1 = require("./utils");

@@ -19,9 +18,6 @@ var json_pivot_1 = require("./json-pivot");

if (excludeKeys === void 0) { excludeKeys = utils_1.omitKeys; }
return (0, json_2_csv_1.json2csv)(withType(nodes), {
return (0, utils_1.jsonToCsv)(withType(nodes), {
keys: keys,
excludeKeys: excludeKeys,
emptyFieldValue: '-',
expandArrayObjects: true,
arrayIndexesAsKeys: true,
sortHeader: true,
parseValue: parseValue

@@ -28,0 +24,0 @@ });

1

index.d.ts

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

export { jsonToCsv } from './utils';
export { toCsvPivot } from './csv-pivot';

@@ -2,0 +3,0 @@ export { pivotNode, pivotNodes } from './json-pivot';

@@ -17,3 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.pivotNodes = exports.pivotNode = exports.toCsvPivot = void 0;
exports.pivotNodes = exports.pivotNode = exports.toCsvPivot = exports.jsonToCsv = void 0;
var utils_1 = require("./utils");
Object.defineProperty(exports, "jsonToCsv", { enumerable: true, get: function () { return utils_1.jsonToCsv; } });
var csv_pivot_1 = require("./csv-pivot");

@@ -20,0 +22,0 @@ Object.defineProperty(exports, "toCsvPivot", { enumerable: true, get: function () { return csv_pivot_1.toCsvPivot; } });

{
"name": "@hestia-earth/schema-convert",
"version": "30.2.1",
"version": "30.3.0",
"description": "HESTIA Schema Converters",

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

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

import { Json2CsvOptions } from 'json-2-csv';
export declare const omitKeys: string[];

@@ -21,1 +22,2 @@ export declare const parentKey: (key: string) => string;

export declare const findNonDuplicates: (values: string[]) => string[];
export declare const jsonToCsv: (values: Record<string, any>[], options?: Json2CsvOptions) => string;

@@ -39,3 +39,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.findNonDuplicates = exports.findDuplicates = exports.convertValue = exports.daysInYear = exports.daysBefore = exports.diffInDays = exports.keyToLabel = exports.ellipsis = exports.reduceUndefinedValues = exports.nonEmptyNode = exports.nonEmptyValue = exports.isEmpty = exports.isNumber = exports.isBoolean = exports.isIri = exports.isExpandable = exports.omit = exports.childkey = exports.parentKey = exports.omitKeys = void 0;
exports.jsonToCsv = exports.findNonDuplicates = exports.findDuplicates = exports.convertValue = exports.daysInYear = exports.daysBefore = exports.diffInDays = exports.keyToLabel = exports.ellipsis = exports.reduceUndefinedValues = exports.nonEmptyNode = exports.nonEmptyValue = exports.isEmpty = exports.isNumber = exports.isBoolean = exports.isIri = exports.isExpandable = exports.omit = exports.childkey = exports.parentKey = exports.omitKeys = void 0;
var json_2_csv_1 = require("json-2-csv");
var get = require('lodash.get');

@@ -165,1 +166,20 @@ var unset = require('lodash.unset');

exports.findNonDuplicates = findNonDuplicates;
/**
* Move every item on the same row.
*
* @param data
* @returns List of original records with less gaps in data.
*/
var compactDataForCsv = function (data) {
return data.reduce(function (prev, curr) {
var _a = __read(Object.entries(curr), 1), _b = __read(_a[0], 2), key = _b[0], value = _b[1];
var prevNoKeyIndex = prev.findIndex(function (p) { return !Object.keys(p).includes(key); });
prevNoKeyIndex >= 0 ? (prev[prevNoKeyIndex][key] = value) : prev.push(curr);
return prev;
}, []);
};
var jsonToCsv = function (values, options) {
if (options === void 0) { options = {}; }
return (0, json_2_csv_1.json2csv)(compactDataForCsv(values), __assign({ emptyFieldValue: '', expandNestedObjects: true, expandArrayObjects: true, arrayIndexesAsKeys: true, sortHeader: true }, options));
};
exports.jsonToCsv = jsonToCsv;
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