diff --git a/.github/workflows/on-push.yaml b/.github/workflows/on-push.yaml
index 8639493..97d2886 100644
--- a/.github/workflows/on-push.yaml
+++ b/.github/workflows/on-push.yaml
@@ -9,12 +9,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest] # macos-latest is too slow
- node-version: [18.x, 16.x]
+ node-version: [20.x, 18.x]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory
@@ -22,7 +22,7 @@ jobs:
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Node.js modules on Linux
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
diff --git a/.github/workflows/on-release.yaml b/.github/workflows/on-release.yaml
index 55a527f..4facc75 100644
--- a/.github/workflows/on-release.yaml
+++ b/.github/workflows/on-release.yaml
@@ -18,11 +18,11 @@ jobs:
- '@json2csv/cli'
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- - uses: actions/setup-node@v3
+ - uses: actions/setup-node@v4
with:
- node-version: '18.x'
+ node-version: '20.x'
# Needs to be explicitly specified for auth to work
registry-url: 'https://registry.npmjs.org'
- run: npm ci
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4fbf936..142f55c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,39 @@
+## [7.0.6](https://github.com/juanjodiaz/json2csv/compare/v7.0.5...v7.0.6) (2024-02-11)
+
+
+### Bug Fixes
+
+* remove legacy unused settings ([bbe451e](https://github.com/juanjodiaz/json2csv/commit/bbe451eea76c7dc757622fb2fc62afeed4836964))
+
+## [7.0.5](https://github.com/juanjodiaz/json2csv/compare/v7.0.4...v7.0.5) (2024-01-20)
+
+
+### Bug Fixes
+
+* fix typings of WHATWG AsyncParser ([610e292](https://github.com/juanjodiaz/json2csv/commit/610e292746ce3349c213b10c2a03d05a77b3dc58))
+* update streamparser version on CDN build ([ab22f53](https://github.com/juanjodiaz/json2csv/commit/ab22f535aef94f430408da1d104298935eb25562))
+
+
+### Performance Improvements
+
+* cache regular expresions for string formatters ([dcaadcf](https://github.com/juanjodiaz/json2csv/commit/dcaadcfce3fb072d920f4f99fdef583adbbcb522))
+
+## [7.0.4](https://github.com/juanjodiaz/json2csv/compare/v7.0.3...v7.0.4) (2023-11-05)
+
+## [7.0.3](https://github.com/juanjodiaz/json2csv/compare/v7.0.2...v7.0.3) (2023-08-24)
+
+
+### Bug Fixes
+
+* fix CDN build & set esbuild to use es2019 ([d59606e](https://github.com/juanjodiaz/json2csv/commit/d59606eb3b01c20ab46547aaddf00e7611c670cd))
+
+## [7.0.3](https://github.com/juanjodiaz/json2csv/compare/v7.0.2...v7.0.3) (2023-08-24)
+
+
+### Bug Fixes
+
+* fix CDN build & set esbuild to use es2019 ([d59606e](https://github.com/juanjodiaz/json2csv/commit/d59606eb3b01c20ab46547aaddf00e7611c670cd))
+
### [7.0.2](https://github.com/juanjodiaz/json2csv/compare/v7.0.1...v7.0.2) (2023-08-16)
diff --git a/README.md b/README.md
index ed0d3e9..3356add 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
[![Coverage Status](https://coveralls.io/repos/github/juanjoDiaz/json2csv/badge.svg?branch=main)](https://coveralls.io/github/juanjoDiaz/json2csv?branch=main)
[![license](https://img.shields.io/npm/l/serverless-plugin-warmup.svg)](https://raw.githubusercontent.com/juanjoDiaz/json2csv/main/LICENSE.md)
-Fast and highly configurable JSON to CSV converter.
+Fast and highly configurable JSON to CSV converter.
## Features
@@ -15,7 +15,7 @@ Fast and highly configurable JSON to CSV converter.
- Advanced data selection (automatic field discovery, underscore-like selectors, custom data getters, default values for missing fields, ...)
- Support for custom input data transformation
- Support for custom csv cell formatting.
-- Highly customizable (supportting custom quotation marks, delimiters, eol values, etc.)
+- Highly customizable (supporting custom quotation marks, delimiters, eol values, etc.)
- Automatic escaping (preserving new lines, quotes, etc.)
- Optional headers
- Unicode encoding support
@@ -27,7 +27,7 @@ Fast and highly configurable JSON to CSV converter.
There are multiple flavours of json2csv:
* The **[Plainjs](https://www.npmjs.com/package/@json2csv/plainjs)** package includes:
- * **[Parser](packages/plainjs/README.md#parser):** Pure Javascript synchronous parser. High-performant and runs both node.js and the browser. It´s the fastes but loads both the JSON and the resulting CSV in memory, and block the event loop while processing. Not recommended unless the JSON data is small.
+ * **[Parser](packages/plainjs/README.md#parser):** Pure Javascript synchronous parser. High-performant and runs both node.js and the browser. It´s the fastest but loads both the JSON and the resulting CSV in memory, and block the event loop while processing. Not recommended unless the JSON data is small.
* **[Stream Parser](packages/plainjs/README.md#stream-parser):** Pure Javascript stream parser. High-performant and runs both node.js and the browser. It keeps a consistent memory footprint and doesn't block the event loop. It's the base of all other parsers. Recommended to build your own parser.
* The **[Node](https://www.npmjs.com/package/@json2csv/node)** packages includes:
* **[Node Transform](packages/node/README.md#node-transform):** Wraps the `Stream Parser` in a Node.js Transform Stream. Recommended for Node.js users using stream.
diff --git a/build-cdn.js b/build-cdn.js
index 1f1fc26..a42f6c8 100644
--- a/build-cdn.js
+++ b/build-cdn.js
@@ -11,7 +11,7 @@ const replaceDependenciesByJsdelivr = {
const [, relativePath] = args.path.match(/\@json2csv\/(.*)/);
return {
- path: path.join('..', relativePath),
+ path: path.join('..', relativePath, 'index.js'),
external: true,
namespace: 'dependency',
};
@@ -28,8 +28,7 @@ const replaceDependenciesByJsdelivr = {
});
const dependencies = {
- '@streamparser/json': `https://cdn.jsdelivr.net/npm/@streamparser/json@${pkg.dependencies['@streamparser/json']}/dist/mjs/index.js`,
- 'lodash.get': 'https://cdn.jsdelivr.net/gh/lodash/lodash@master/get.js'
+ '@streamparser/json': `https://cdn.jsdelivr.net/npm/@streamparser/json@${pkg.dependencies['@streamparser/json']}/dist/mjs/index.js`
};
build.onResolve({ namespace: 'file', filter: new RegExp(`(?:${Object.keys(dependencies).join('|')})`) }, (args) => {
@@ -52,6 +51,7 @@ pkgs.forEach(async (pkg) => {
esbuild.build({
entryPoints,
bundle: true,
+ target: 'es2019',
format: 'esm',
outdir: `dist/cdn/${pkg}`,
plugins: [replaceDependenciesByJsdelivr],
diff --git a/dist/cdn/formatters/string.js b/dist/cdn/formatters/string.js
index dd2f4c5..014aced 100644
--- a/dist/cdn/formatters/string.js
+++ b/dist/cdn/formatters/string.js
@@ -5,9 +5,10 @@ function stringFormatter(opts = {}) {
if (!quote || quote === escapedQuote) {
return (value) => value;
}
+ const quoteRegExp = new RegExp(quote, "g");
return (value) => {
if (value.includes(quote)) {
- value = value.replace(new RegExp(quote, "g"), escapedQuote);
+ value = value.replace(quoteRegExp, escapedQuote);
}
return `${quote}${value}${quote}`;
};
diff --git a/dist/cdn/formatters/stringExcel.js b/dist/cdn/formatters/stringExcel.js
index a0339cb..6eeeefb 100644
--- a/dist/cdn/formatters/stringExcel.js
+++ b/dist/cdn/formatters/stringExcel.js
@@ -1,8 +1,9 @@
// packages/formatters/src/stringExcel.ts
var quote = '"';
var escapedQuote = '""""';
+var quoteRegExp = new RegExp(quote, "g");
function stringExcel(value) {
- return `"=""${value.replace(new RegExp(quote, "g"), escapedQuote)}"""`;
+ return `"=""${value.replace(quoteRegExp, escapedQuote)}"""`;
}
export {
stringExcel as default
diff --git a/dist/cdn/plainjs/BaseParser.js b/dist/cdn/plainjs/BaseParser.js
index 56aba5d..e8ac8d9 100644
--- a/dist/cdn/plainjs/BaseParser.js
+++ b/dist/cdn/plainjs/BaseParser.js
@@ -1,29 +1,11 @@
-var __defProp = Object.defineProperty;
-var __getOwnPropSymbols = Object.getOwnPropertySymbols;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __propIsEnum = Object.prototype.propertyIsEnumerable;
-var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
-var __spreadValues = (a, b) => {
- for (var prop in b ||= {})
- if (__hasOwnProp.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- if (__getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(b)) {
- if (__propIsEnum.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- }
- return a;
-};
-
// packages/plainjs/src/BaseParser.ts
-import lodashGet from "https://cdn.jsdelivr.net/gh/lodash/lodash@master/get.js";
import {
default as defaultFormatter,
number as numberFormatterCtor,
string as stringFormatterCtor,
symbol as symbolFormatterCtor,
object as objectFormatterCtor
-} from "../formatters";
+} from "../formatters/index.js";
import { getProp, flattenReducer, fastJoin } from "./utils.js";
var FormatterTypes = /* @__PURE__ */ ((FormatterTypes2) => {
FormatterTypes2["header"] = "header";
@@ -45,7 +27,7 @@ var JSON2CSVBase = class {
* Check passing opts and set defaults.
*
* @param {Json2CsvOptions} opts Options object containing fields,
- * delimiter, default value, quote mark, header, etc.
+ * delimiter, default value, header, etc.
*/
preprocessOpts(opts) {
const processedOpts = Object.assign(
@@ -72,7 +54,10 @@ var JSON2CSVBase = class {
function: objectFormatter,
object: objectFormatter
};
- processedOpts.formatters = __spreadValues(__spreadValues({}, defaultFormatters), processedOpts.formatters);
+ processedOpts.formatters = {
+ ...defaultFormatters,
+ ...processedOpts.formatters
+ };
processedOpts.delimiter = processedOpts.delimiter || ",";
processedOpts.eol = processedOpts.eol || "\n";
processedOpts.header = processedOpts.header !== false;
@@ -92,7 +77,7 @@ var JSON2CSVBase = class {
if (typeof fieldInfo === "string") {
return {
label: fieldInfo,
- value: fieldInfo.includes(".") || fieldInfo.includes("[") ? (row) => lodashGet(row, fieldInfo, globalDefaultValue) : (row) => getProp(row, fieldInfo, globalDefaultValue)
+ value: (row) => getProp(row, fieldInfo, globalDefaultValue)
};
}
if (typeof fieldInfo === "object") {
@@ -101,7 +86,7 @@ var JSON2CSVBase = class {
const fieldPath = fieldInfo.value;
return {
label: fieldInfo.label || fieldInfo.value,
- value: fieldInfo.value.includes(".") || fieldInfo.value.includes("[") ? (row) => lodashGet(row, fieldPath, defaultValue) : (row) => getProp(row, fieldPath, defaultValue)
+ value: (row) => getProp(row, fieldPath, defaultValue)
};
}
if (typeof fieldInfo.value === "function") {
diff --git a/dist/cdn/plainjs/StreamParser.js b/dist/cdn/plainjs/StreamParser.js
index ac56ea3..f487ef1 100644
--- a/dist/cdn/plainjs/StreamParser.js
+++ b/dist/cdn/plainjs/StreamParser.js
@@ -1,30 +1,10 @@
-var __defProp = Object.defineProperty;
-var __defProps = Object.defineProperties;
-var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
-var __getOwnPropSymbols = Object.getOwnPropertySymbols;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __propIsEnum = Object.prototype.propertyIsEnumerable;
-var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
-var __spreadValues = (a, b) => {
- for (var prop in b ||= {})
- if (__hasOwnProp.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- if (__getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(b)) {
- if (__propIsEnum.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- }
- return a;
-};
-var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
-
// packages/plainjs/src/StreamParser.ts
import {
Tokenizer,
TokenParser,
TokenType,
TokenizerError
-} from "https://cdn.jsdelivr.net/npm/@streamparser/json@^0.0.15/dist/mjs/index.js";
+} from "https://cdn.jsdelivr.net/npm/@streamparser/json@^0.0.19/dist/mjs/index.js";
import JSON2CSVBase from "./BaseParser.js";
var JSON2CSVStreamParser = class extends JSON2CSVBase {
constructor(opts, asyncOpts) {
@@ -70,7 +50,7 @@ var JSON2CSVStreamParser = class extends JSON2CSVBase {
};
}
getNdJsonTokenizer(asyncOpts) {
- const tokenizer = new Tokenizer(__spreadProps(__spreadValues({}, asyncOpts), { separator: this.opts.eol }));
+ const tokenizer = new Tokenizer({ ...asyncOpts, separator: this.opts.eol });
this.tokenParser = new TokenParser({
paths: ["$"],
keepStack: false,
diff --git a/dist/cdn/plainjs/utils.js b/dist/cdn/plainjs/utils.js
index 0f88952..b4044b2 100644
--- a/dist/cdn/plainjs/utils.js
+++ b/dist/cdn/plainjs/utils.js
@@ -1,7 +1,31 @@
// packages/plainjs/src/utils.ts
+var rePropName = RegExp(
+ // Match anything that isn't a dot or bracket.
+ `[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,
+ "g"
+);
+function castPath(value) {
+ var _a, _b, _c;
+ const result = [];
+ let match;
+ while (match = rePropName.exec(value)) {
+ result.push((_c = (_b = match[3]) != null ? _b : (_a = match[1]) == null ? void 0 : _a.trim()) != null ? _c : match[0]);
+ }
+ return result;
+}
function getProp(obj, path, defaultValue) {
- const value = obj[path];
- return value === void 0 ? defaultValue : value;
+ if (path in obj) {
+ const value = obj[path];
+ return value === void 0 ? defaultValue : value;
+ }
+ const processedPath = Array.isArray(path) ? path : castPath(path, obj);
+ let currentValue = obj;
+ for (const key of processedPath) {
+ currentValue = currentValue == null ? void 0 : currentValue[key];
+ if (currentValue === void 0)
+ return defaultValue;
+ }
+ return currentValue;
}
function flattenReducer(acc, arr) {
try {
diff --git a/dist/cdn/transforms/unwind.js b/dist/cdn/transforms/unwind.js
index 39fc5e5..5c3093f 100644
--- a/dist/cdn/transforms/unwind.js
+++ b/dist/cdn/transforms/unwind.js
@@ -1,6 +1,5 @@
// packages/transforms/src/unwind.ts
-import lodashGet from "https://cdn.jsdelivr.net/gh/lodash/lodash@master/get.js";
-import { setProp, unsetProp, flattenReducer } from "./utils.js";
+import { getProp, setProp, unsetProp, flattenReducer } from "./utils.js";
function getUnwindablePaths(obj, currentPath) {
return Object.keys(obj).reduce(
(unwindablePaths, key) => {
@@ -24,7 +23,7 @@ function getUnwindablePaths(obj, currentPath) {
function unwind(opts = {}) {
function unwindReducer(rows, unwindPath) {
return rows.flatMap((row) => {
- const unwindArray = lodashGet(row, unwindPath);
+ const unwindArray = getProp(row, unwindPath);
if (!Array.isArray(unwindArray)) {
return row;
}
diff --git a/dist/cdn/transforms/utils.js b/dist/cdn/transforms/utils.js
index 132eecb..2cbcf5a 100644
--- a/dist/cdn/transforms/utils.js
+++ b/dist/cdn/transforms/utils.js
@@ -1,24 +1,32 @@
-var __defProp = Object.defineProperty;
-var __defProps = Object.defineProperties;
-var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
-var __getOwnPropSymbols = Object.getOwnPropertySymbols;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __propIsEnum = Object.prototype.propertyIsEnumerable;
-var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
-var __spreadValues = (a, b) => {
- for (var prop in b ||= {})
- if (__hasOwnProp.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- if (__getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(b)) {
- if (__propIsEnum.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- }
- return a;
-};
-var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
-
// packages/transforms/src/utils.ts
+var rePropName = RegExp(
+ // Match anything that isn't a dot or bracket.
+ `[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,
+ "g"
+);
+function castPath(value) {
+ var _a, _b, _c;
+ const result = [];
+ let match;
+ while (match = rePropName.exec(value)) {
+ result.push((_c = (_b = match[3]) != null ? _b : (_a = match[1]) == null ? void 0 : _a.trim()) != null ? _c : match[0]);
+ }
+ return result;
+}
+function getProp(obj, path, defaultValue) {
+ if (path in obj) {
+ const value = obj[path];
+ return value === void 0 ? defaultValue : value;
+ }
+ const processedPath = Array.isArray(path) ? path : castPath(path, obj);
+ let currentValue = obj;
+ for (const key of processedPath) {
+ currentValue = currentValue == null ? void 0 : currentValue[key];
+ if (currentValue === void 0)
+ return defaultValue;
+ }
+ return currentValue;
+}
function propertyPathToString(path) {
if (typeof path === "string")
return path.split(".");
@@ -27,9 +35,10 @@ function propertyPathToString(path) {
function setProp(obj, path, value) {
const pathArray = propertyPathToString(path);
const [key, ...restPath] = pathArray;
- return __spreadProps(__spreadValues({}, obj), {
+ return {
+ ...obj,
[key]: pathArray.length > 1 ? setProp(obj[key] || {}, restPath, value) : value
- });
+ };
}
function unsetProp(obj, path) {
const pathArray = propertyPathToString(path);
@@ -39,12 +48,13 @@ function unsetProp(obj, path) {
}
if (pathArray.length === 1) {
return Object.keys(obj).filter((prop) => prop !== key).reduce(
- (acc, prop) => __spreadProps(__spreadValues({}, acc), { [prop]: obj[prop] }),
+ (acc, prop) => ({ ...acc, [prop]: obj[prop] }),
{}
);
}
return Object.keys(obj).reduce(
- (acc, prop) => __spreadProps(__spreadValues({}, acc), {
+ (acc, prop) => ({
+ ...acc,
[prop]: prop !== key ? obj[prop] : unsetProp(obj[key], restPath)
}),
{}
@@ -60,6 +70,7 @@ function flattenReducer(acc, arr) {
}
export {
flattenReducer,
+ getProp,
setProp,
unsetProp
};
diff --git a/dist/cdn/whatwg/TransformStream.js b/dist/cdn/whatwg/TransformStream.js
index f11b85d..34e1da8 100644
--- a/dist/cdn/whatwg/TransformStream.js
+++ b/dist/cdn/whatwg/TransformStream.js
@@ -1,28 +1,7 @@
-var __async = (__this, __arguments, generator) => {
- return new Promise((resolve, reject) => {
- var fulfilled = (value) => {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- };
- var rejected = (value) => {
- try {
- step(generator.throw(value));
- } catch (e) {
- reject(e);
- }
- };
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
- step((generator = generator.apply(__this, __arguments)).next());
- });
-};
-
// packages/whatwg/src/TransformStream.ts
import {
StreamParser
-} from "../plainjs";
+} from "../plainjs/index.js";
var JSON2CSVWHATWGTransformer = class extends StreamParser {
constructor(opts = {}, asyncOpts = {}) {
super(opts, asyncOpts);
@@ -61,16 +40,16 @@ var JSON2CSVWHATWGTransformStream = class extends TransformStream {
this.dispatchEvent(new CustomEvent("data", { detail: data }));
};
}
- this.readable.promise = () => __async(this, null, function* () {
+ this.readable.promise = async () => {
let csv = "";
const outputStream = new WritableStream({
write(chunk) {
csv += chunk;
}
});
- yield this.readable.pipeTo(outputStream);
+ await this.readable.pipeTo(outputStream);
return csv;
- });
+ };
}
addEventListener(type, callback, options) {
var _a;
diff --git a/dist/cdn/whatwg/index.js b/dist/cdn/whatwg/index.js
index f50b034..9cfa4c7 100644
--- a/dist/cdn/whatwg/index.js
+++ b/dist/cdn/whatwg/index.js
@@ -1,6 +1,8 @@
// packages/whatwg/src/index.ts
import { default as default2 } from "./AsyncParser.js";
-import { default as default3 } from "./TransformStream.js";
+import {
+ default as default3
+} from "./TransformStream.js";
export {
default2 as AsyncParser,
default3 as TransformStream
diff --git a/docs/README.md b/docs/README.md
index e611f97..ec63c5c 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -18,7 +18,7 @@ Can be used as a module from node.js or the browser as well as from the command
- Advanced data selection (automatic field discovery, underscore-like selectors, custom data getters, default values for missing fields, ...)
- Support for custom input data transformation
- Support for custom csv cell formatting.
-- Highly customizable (supportting custom quotation marks, delimiters, eol values, etc.)
+- Highly customizable (supporting custom quotation marks, delimiters, eol values, etc.)
- Automatic escaping (preserving new lines, quotes, etc.)
- Optional headers
- Unicode encoding support
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index a9c71f1..9fd74f3 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -21,6 +21,7 @@
- [CSV Customization](advanced-options/csv-customization.md)
- Migration Guides
+ - [6.X to 7.X](migration-guides/6-to-7.md)
- [5.X to 6.X](migration-guides/5-to-6.md)
- [4.X to 5.X](migration-guides/4-to-5.md)
- [3.X to 4.X](migration-guides/3-to-4.md)
diff --git a/docs/advanced-options/formatters.md b/docs/advanced-options/formatters.md
index 0d5d3dd..6468d8f 100644
--- a/docs/advanced-options/formatters.md
+++ b/docs/advanced-options/formatters.md
@@ -81,7 +81,7 @@ You can also select a specific version:
```html
```
@@ -279,7 +279,7 @@ As with the sample transform in the previous section, the reason to wrap the act
Keep in mind that the above example doesn't quote or escape the string which is problematic. A more realistic example could use our built-in string formatted to do the quoting and escaping like:
```js
-import { string as defaultStringFormatter } from 'json2csv/formatters';
+import { string as defaultStringFormatter } from '@json2csv/formatters';
const fixedLengthStringFormatter = (stringLength, ellipsis = '...', stringFormatter = defaultStringFormatter()) =>
(item) =>
diff --git a/docs/advanced-options/transforms.md b/docs/advanced-options/transforms.md
index 14d0b3d..ea8bf3a 100644
--- a/docs/advanced-options/transforms.md
+++ b/docs/advanced-options/transforms.md
@@ -53,7 +53,7 @@ You can also select a specific version:
```html
```
@@ -285,7 +285,7 @@ try {
const opts = {
transforms: [
unwind({ paths: ['fieldToUnwind','fieldToUnwind.subfieldToUnwind'], blankOut: true }),
- flatten({ object: true, array: true, separator: '_'}),
+ flatten({ objects: true, arrays: true, separator: '_'}),
addCounter()
]
};
@@ -307,7 +307,7 @@ import { addCounter } from './custom-transforms';
const opts = {
transforms: [
unwind({ paths: ['fieldToUnwind','fieldToUnwind.subfieldToUnwind'], blankOut: true }),
- flatten({ object: true, array: true, separator: '_'}),
+ flatten({ objects: true, arrays: true, separator: '_'}),
addCounter()
]
};
@@ -336,7 +336,7 @@ const output = createWriteStream(outputPath, { encoding: 'utf8' });
const opts = {
transforms: [
unwind({ paths: ['fieldToUnwind','fieldToUnwind.subfieldToUnwind'], blankOut: true }),
- flatten({ object: true, array: true, separator: '_'}),
+ flatten({ objects: true, arrays: true, separator: '_'}),
addCounter()
]
};
@@ -360,7 +360,7 @@ import { addCounter } from './custom-transforms';
const opts = {
transforms: [
unwind({ paths: ['fieldToUnwind','fieldToUnwind.subfieldToUnwind'], blankOut: true }),
- flatten({ object: true, array: true, separator: '_'}),
+ flatten({ objects: true, arrays: true, separator: '_'}),
addCounter()
]
};
@@ -379,7 +379,7 @@ import { addCounter } from './custom-transforms';
const opts = {
transforms: [
unwind({ paths: ['fieldToUnwind','fieldToUnwind.subfieldToUnwind'], blankOut: true }),
- flatten({ object: true, array: true, separator: '_'}),
+ flatten({ objects: true, arrays: true, separator: '_'}),
addCounter()
]
};
diff --git a/docs/index.html b/docs/index.html
index ec55585..c295ea3 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,9 +170,9 @@