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

@material-table/exporters

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material-table/exporters - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

25

csv/index.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,5 +10,10 @@ value: true

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _filefy = require("filefy");
function ExportCsv(columns, data) {
function ExportCsv(columns) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var filename = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'data';

@@ -16,6 +23,20 @@ var delimiter = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ',';

try {
var finalData = data; // Grab first item for data array, make sure it is also an array.
// If it is an object, 'flatten' it into an array of strings.
if (data.length && !Array.isArray(data[0])) {
if ((0, _typeof2["default"])(data[0]) === 'object') {
// Turn data into an array of string arrays, without the `tableData` prop
finalData = data.map(function (_ref) {
var tableData = _ref.tableData,
row = (0, _objectWithoutProperties2["default"])(_ref, ["tableData"]);
return Object.values(row);
});
}
}
var builder = new _filefy.CsvBuilder(filename + '.csv');
builder.setDelimeter(delimiter).setColumns(columns.map(function (col) {
return col.title;
})).addRows(Array.from(data)).exportFile();
})).addRows(Array.from(finalData)).exportFile();
} catch (err) {

@@ -22,0 +43,0 @@ console.error("error in ExportCsv : ".concat(err));

2

package.json

@@ -6,3 +6,3 @@ {

},
"version": "1.0.5",
"version": "1.0.6",
"description": "Helper export methods for @material-table/core",

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

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