@teselagen/file-utils 0.3.16 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index.mjs → index.cjs} +1742 -6151
- package/index.d.ts +1 -1
- package/index.js +1661 -6070
- package/{index.umd.js → index.umd.cjs} +1642 -6051
- package/package.json +2 -2
- package/src/file-utils.js +12 -2
package/package.json
CHANGED
package/src/file-utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Copyright (C) 2018 TeselaGen Biotechnology, Inc. */
|
|
2
|
-
import { camelCase, flatMap, remove, startsWith, snakeCase } from "lodash";
|
|
2
|
+
import { camelCase, flatMap, remove, startsWith, snakeCase } from "lodash-es";
|
|
3
3
|
import { loadAsync } from "jszip";
|
|
4
4
|
import Promise from "bluebird";
|
|
5
5
|
import { parse, unparse } from "papaparse";
|
|
@@ -75,7 +75,6 @@ export const extractZipFiles = async allFiles => {
|
|
|
75
75
|
const defaultCsvParserOptions = {
|
|
76
76
|
header: true,
|
|
77
77
|
skipEmptyLines: "greedy",
|
|
78
|
-
trimHeaders: true
|
|
79
78
|
};
|
|
80
79
|
export const setupCsvParserOptions = (parserOptions = {}) => {
|
|
81
80
|
const {
|
|
@@ -123,6 +122,17 @@ export const setupCsvParserOptions = (parserOptions = {}) => {
|
|
|
123
122
|
return transHeader;
|
|
124
123
|
};
|
|
125
124
|
}
|
|
125
|
+
// tnw: the papaparse trimHeaders option was removed so we need to trim headers manually
|
|
126
|
+
const transformToAlwaysRun = header => header.trim();
|
|
127
|
+
if (parserOptions.transformHeader) {
|
|
128
|
+
const existingTransformHeader = parserOptions.transformHeader;
|
|
129
|
+
papaParseOpts.transformHeader = header => {
|
|
130
|
+
const trimmedHeader = transformToAlwaysRun(header);
|
|
131
|
+
return existingTransformHeader(trimmedHeader);
|
|
132
|
+
};
|
|
133
|
+
} else {
|
|
134
|
+
papaParseOpts.transformHeader = transformToAlwaysRun;
|
|
135
|
+
}
|
|
126
136
|
|
|
127
137
|
return papaParseOpts;
|
|
128
138
|
};
|