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

@sigeo/export-to-csv

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sigeo/export-to-csv - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.babelrc

48

lib/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var isEmpty = require("lodash/isEmpty");
var moment = require("moment");
var exportToCsv = function (data, fileName) {
if (isEmpty(data)) {
return new Error("Export CSV - You should pass me an array of arrays!");
}
var name = fileName || moment().format("YYYY-MM-DD");
var csvContent = "data:text/csv;charset=utf-8," + (data && data.map(function (e) { return e.join(","); }).join("\n"));
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", name + ".csv");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
var _moment = _interopRequireDefault(require("moment"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var exportToCsv = function exportToCsv(data, fileName) {
if ((0, _isEmpty["default"])(data)) {
return new Error('Export CSV - You should pass me an array of arrays!');
}
var name = fileName || (0, _moment["default"])().format('YYYY-MM-DD');
var csvContent = "data:text/csv;charset=utf-8,".concat(data && data.map(function (e) {
return e.join(',');
}).join('\n'));
var encodedUri = encodeURI(csvContent);
var link = document.createElement('a');
link.setAttribute('href', encodedUri);
link.setAttribute('download', "".concat(name, ".csv"));
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
exports.default = exportToCsv;
var _default = exportToCsv;
exports["default"] = _default;
{
"name": "@sigeo/export-to-csv",
"version": "0.1.0",
"version": "0.2.0",
"description": "Export to CSV - Simple way to generate a CSV from Vanilla JS!",
"main": "lib/index.js",
"scripts": {
"build": "./node_modules/.bin/tsc",
"build": "./node_modules/@babel/cli/bin/babel.js index.js -d lib --copy-files",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -20,7 +20,11 @@ },

"homepage": "https://github.com/sigeodev/export-to-csv#readme",
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4"
},
"dependencies": {
"lodash": "^4.17.11",
"moment": "^2.24.0",
"typescript": "^3.5.1"
"moment": "^2.24.0"
}
}
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