Socket
Socket
Sign inDemoInstall

react-json-to-csv

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

12

dist/index.js

@@ -9,3 +9,3 @@ "use strict";

var _jsonToCsvExport = _interopRequireDefault(require("json-to-csv-export"));
var _excluded = ["data", "filename"];
var _excluded = ["data", "filename", "delimiter", "headers"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -15,5 +15,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var CsvDownload = function CsvDownload(props) {
var CsvDownloadButton = function CsvDownloadButton(props) {
var data = props.data,
filename = props.filename,
delimiter = props.delimiter,
headers = props.headers,
others = _objectWithoutProperties(props, _excluded);

@@ -24,3 +26,5 @@ return /*#__PURE__*/_react["default"].createElement("button", _extends({

data: data,
filename: filename
filename: filename,
delimiter: delimiter,
headers: headers
});

@@ -30,3 +34,3 @@ }

};
var _default = CsvDownload;
var _default = CsvDownloadButton;
exports["default"] = _default;
{
"name": "react-json-to-csv",
"version": "1.1.0",
"version": "1.2.0",
"description": "A react button component to easily generate csv downloads of your json data.",

@@ -53,3 +53,3 @@ "main": "dist/index.js",

"@babel/preset-react": "7.18.6",
"core-js": "3.25.5",
"core-js": "3.26.0",
"coveralls": "3.1.1",

@@ -61,3 +61,3 @@ "enzyme": "3.11.0",

"instant-table": "3.0.0",
"jest": "29.2.1",
"jest": "29.2.2",
"mdx-go": "1.1.11",

@@ -64,0 +64,0 @@ "prettier": "2.7.1",

# ⌗ react-json-to-csv
A react button component to easily generate csv downloads of your json data. ✨

@@ -8,6 +9,8 @@

## Live Demo
## Live Demo
[https://react-json-to-csv.coston.io](https://react-json-to-csv.coston.io)
## Features
- Create a csv download from json data

@@ -21,6 +24,9 @@ - Lightweight

Install with npm:
```sh
npm i react-json-to-csv
```
Or load from a CDN:
```html

@@ -31,7 +37,8 @@ <script src="https://cdn.jsdelivr.net/npm/react-json-to-csv" />

## Example Usage
```jsx
import CsvDownload from 'react-json-to-csv'
import CsvDownloadButton from 'react-json-to-csv'
...
<CsvDownload data={mockData} />
<CsvDownloadButton data={mockData} />
```

@@ -41,9 +48,13 @@

| Prop | Type | Requirement | Default | Description |
| --------- | --------- | ------------ | ------- | --------------------------------------------------- |
| data | `object` | `required` | `null` | object or array of objects |
| filename| `string` | `optional` | "export.csv" | The complete filename |
| # | Property | Type | Requirement | Default | Description |
| --- | --------- | ---------- | ----------- | ------------------------- | ----------------------------------------------------------------------------- |
| 1 | data | `[]` | `required` | | array of objects |
| 2 | filename | `string` | `optional` | "export.csv" | The filename. The `.csv` extention will be edded if not included in file name |
| 3 | delimiter | `string` | `optional` | ";" | fields separator |
| 4 | headers | `string[]` | `optional` | provided data object keys | List of columns that will be used in the final CSV file. |
## Typescript Support
## Typescript Support
Install types with npm
```sh

@@ -50,0 +61,0 @@ npm i --save-dev @types/react-json-to-csv

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc