Skip to content

Commit

Permalink
chore: upgrade json-to-csv-export
Browse files Browse the repository at this point in the history
  • Loading branch information
coston committed Sep 14, 2022
1 parent e593dbd commit 9cc62ca
Show file tree
Hide file tree
Showing 5 changed files with 2,496 additions and 3,471 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -77,3 +77,6 @@ typings/

# Demo site
public

# transpiled output
dist
11 changes: 8 additions & 3 deletions dist/index.js
Expand Up @@ -9,9 +9,11 @@ var _react = _interopRequireDefault(require("react"));

var _jsonToCsvExport = _interopRequireDefault(require("json-to-csv-export"));

var _excluded = ["data", "filename"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || 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 _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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

Expand All @@ -20,11 +22,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
var CsvDownload = function CsvDownload(props) {
var data = props.data,
filename = props.filename,
others = _objectWithoutProperties(props, ["data", "filename"]);
others = _objectWithoutProperties(props, _excluded);

return /*#__PURE__*/_react["default"].createElement("button", _extends({
onClick: function onClick() {
return (0, _jsonToCsvExport["default"])(data, filename);
return (0, _jsonToCsvExport["default"])({
data: data,
filename: filename
});
}
}, others), props.children || 'Download Data');
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -78,6 +78,6 @@
"test": "test"
},
"dependencies": {
"json-to-csv-export": "1.1.2"
"json-to-csv-export": "2.0.1"
}
}
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -5,7 +5,7 @@ const CsvDownload = (props) => {
const { data, filename, ...others } = props

return (
<button onClick={() => csvDownload(data, filename)} {...others}>
<button onClick={() => csvDownload({ data, filename })} {...others}>
{props.children || 'Download Data'}
</button>
)
Expand Down

0 comments on commit 9cc62ca

Please sign in to comment.