@softwareventures/csv
Advanced tools
Comparing version 1.0.3 to 2.0.0
@@ -1,2 +0,2 @@ | ||
import { ReadonlyTable } from "@softwareventures/table"; | ||
import type { ReadonlyTable } from "@softwareventures/table"; | ||
export interface Configuration { | ||
@@ -3,0 +3,0 @@ readonly separator?: string; |
19
index.js
@@ -63,5 +63,7 @@ "use strict"; | ||
function parse(data, configuration) { | ||
const separator = configuration && configuration.separator || defaultSeparator; | ||
const quote = configuration && configuration.quote || defaultQuote; | ||
const resultState = String(data).split("") | ||
var _a, _b; | ||
const separator = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.separator) !== null && _a !== void 0 ? _a : defaultSeparator; | ||
const quote = (_b = configuration === null || configuration === void 0 ? void 0 : configuration.quote) !== null && _b !== void 0 ? _b : defaultQuote; | ||
const resultState = String(data) | ||
.split("") | ||
.reduce((data, char) => { | ||
@@ -105,10 +107,9 @@ if (data.state === "after-comma" && char === " ") { | ||
function write(table, configuration) { | ||
const separator = configuration && configuration.separator || defaultSeparator; | ||
const quote = configuration && configuration.quote || defaultQuote; | ||
const quoteRegex = new RegExp(regexEscape(quote), "g"); | ||
return (0, array_1.map)(table, row => (0, array_1.map)(row, field => quote + field.replace(quoteRegex, quote + quote) + quote) | ||
.join(separator)) | ||
.join("\r\n"); | ||
var _a, _b; | ||
const separator = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.separator) !== null && _a !== void 0 ? _a : defaultSeparator; | ||
const quote = (_b = configuration === null || configuration === void 0 ? void 0 : configuration.quote) !== null && _b !== void 0 ? _b : defaultQuote; | ||
const quoteRegex = new RegExp(regexEscape(quote), "gu"); | ||
return (0, array_1.map)(table, row => (0, array_1.map)(row, field => quote + field.replace(quoteRegex, quote + quote) + quote).join(separator)).join("\r\n"); | ||
} | ||
exports.write = write; | ||
//# sourceMappingURL=index.js.map |
Copyright 2018-2022 Software Ventures Limited. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
Permission to use, copy, modify, and/or distribute this software for any purpose | ||
with or without fee is hereby granted, provided that the above copyright notice | ||
and this permission notice appear in all copies. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | ||
THIS SOFTWARE. |
{ | ||
"name": "@softwareventures/csv", | ||
"version": "1.0.3", | ||
"version": "2.0.0", | ||
"description": "Parser and serializer for CSV and related formats", | ||
@@ -18,5 +18,5 @@ "keywords": [ | ||
"scripts": { | ||
"fix": "tsc --noEmit && tslint --fix --project .", | ||
"lint": "tsc --noEmit && tslint --project .", | ||
"prepare": "tslint --project . && tsc", | ||
"fix": "tsc --noEmit && eslint . --fix && prettier --write .", | ||
"lint": "tsc --noEmit && eslint . && prettier --check .", | ||
"prepare": "tsc", | ||
"semantic-release": "semantic-release", | ||
@@ -27,19 +27,33 @@ "test": "echo No tests yet" | ||
"engines": { | ||
"node": "^12 || ^14 || >=16" | ||
"node": "^14 || ^16 || >=18" | ||
}, | ||
"dependencies": { | ||
"@softwareventures/array": "^0.31.0 || ^0.33.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", | ||
"@softwareventures/eslint-config": "7.0.1", | ||
"@softwareventures/prettier-config": "^3.0.0", | ||
"@softwareventures/table": "^0.1.2 || ^1.0.0", | ||
"escape-string-regexp": "^4.0.0", | ||
"eslint": "^8.14.0", | ||
"prettier": "^2.6.2", | ||
"tslib": "^1.9.3 || ^2.0.0 || ^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@softwareventures/semantic-release-config": "2.0.2", | ||
"@softwareventures/semantic-release-config": "2.0.3", | ||
"@softwareventures/tsconfig": "6.0.0", | ||
"@softwareventures/tslint-rules": "1.0.0", | ||
"@typescript-eslint/eslint-plugin": "5.43.0", | ||
"@typescript-eslint/parser": "5.43.0", | ||
"cz-conventional-changelog": "3.3.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-jsdoc": "39.6.2", | ||
"eslint-plugin-prefer-arrow": "1.2.3", | ||
"eslint-plugin-sonarjs": "0.16.0", | ||
"semantic-release": "17.4.7", | ||
"tslint": "6.1.3", | ||
"typescript": "4.6.4" | ||
"typescript": "4.8.4" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"extends": "@softwareventures" | ||
}, | ||
"prettier": "@softwareventures/prettier-config", | ||
"config": { | ||
@@ -46,0 +60,0 @@ "commitizen": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14594
7
121
8
12
+ Addedeslint@^8.14.0
+ Addedprettier@^2.6.2
+ Added@es-joy/jsdoccomment@0.36.1(transitive)
+ Added@eslint-community/eslint-utils@4.4.1(transitive)
+ Added@eslint-community/regexpp@4.12.1(transitive)
+ Added@eslint/eslintrc@2.1.4(transitive)
+ Added@eslint/js@8.57.1(transitive)
+ Added@humanwhocodes/config-array@0.13.0(transitive)
+ Added@humanwhocodes/module-importer@1.0.1(transitive)
+ Added@humanwhocodes/object-schema@2.0.3(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@rtsao/scc@1.1.0(transitive)
+ Added@softwareventures/eslint-config@7.0.1(transitive)
+ Added@softwareventures/prettier-config@3.0.0(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Added@types/json5@0.0.29(transitive)
+ Added@types/semver@7.5.8(transitive)
+ Added@typescript-eslint/eslint-plugin@5.62.0(transitive)
+ Added@typescript-eslint/parser@5.62.0(transitive)
+ Added@typescript-eslint/scope-manager@5.62.0(transitive)
+ Added@typescript-eslint/type-utils@5.62.0(transitive)
+ Added@typescript-eslint/types@5.62.0(transitive)
+ Added@typescript-eslint/typescript-estree@5.62.0(transitive)
+ Added@typescript-eslint/utils@5.62.0(transitive)
+ Added@typescript-eslint/visitor-keys@5.62.0(transitive)
+ Added@ungap/structured-clone@1.2.0(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedacorn-jsx@5.3.2(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarray-includes@3.1.8(transitive)
+ Addedarray-union@2.1.0(transitive)
+ Addedarray.prototype.findlastindex@1.2.5(transitive)
+ Addedarray.prototype.flat@1.3.2(transitive)
+ Addedarray.prototype.flatmap@1.3.2(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcomment-parser@1.3.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcross-spawn@7.0.5(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddebug@3.2.74.3.7(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddir-glob@3.0.1(transitive)
+ Addeddoctrine@2.1.03.0.0(transitive)
+ Addedes-abstract@1.23.4(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-shim-unscopables@1.0.2(transitive)
+ Addedes-to-primitive@1.2.1(transitive)
+ Addedeslint@8.57.1(transitive)
+ Addedeslint-config-prettier@8.10.0(transitive)
+ Addedeslint-import-resolver-node@0.3.9(transitive)
+ Addedeslint-module-utils@2.12.0(transitive)
+ Addedeslint-plugin-import@2.31.0(transitive)
+ Addedeslint-plugin-jsdoc@39.9.1(transitive)
+ Addedeslint-plugin-prefer-arrow@1.2.3(transitive)
+ Addedeslint-plugin-sonarjs@0.15.0(transitive)
+ Addedeslint-scope@5.1.17.2.2(transitive)
+ Addedeslint-visitor-keys@3.4.3(transitive)
+ Addedespree@9.6.1(transitive)
+ Addedesquery@1.6.0(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedfile-entry-cache@6.0.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedflat-cache@3.2.0(transitive)
+ Addedflatted@3.3.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-parent@5.1.26.0.2(transitive)
+ Addedglobals@13.24.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedglobby@11.1.0(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedgraphemer@1.4.0(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-data-view@1.0.1(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-path-inside@3.0.3(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakref@1.0.2(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedjsdoc-type-pratt-parser@3.1.0(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stable-stringify-without-jsonify@1.0.1(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlevn@0.4.1(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedms@2.1.3(transitive)
+ Addednatural-compare@1.4.0(transitive)
+ Addednatural-compare-lite@1.4.0(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedobject.fromentries@2.0.8(transitive)
+ Addedobject.groupby@1.0.3(transitive)
+ Addedobject.values@1.2.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedoptionator@0.9.4(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedprelude-ls@1.2.1(transitive)
+ Addedprettier@2.8.8(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedsafe-array-concat@1.1.2(transitive)
+ Addedsafe-regex-test@1.0.3(transitive)
+ Addedsemver@6.3.17.6.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstring.prototype.trim@1.2.9(transitive)
+ Addedstring.prototype.trimend@1.0.8(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtsconfig-paths@3.15.0(transitive)
+ Addedtslib@1.14.12.3.1(transitive)
+ Addedtsutils@3.21.0(transitive)
+ Addedtype-check@0.4.0(transitive)
+ Addedtype-fest@0.20.2(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.2(transitive)
+ Addedtyped-array-length@1.0.6(transitive)
+ Addedtypescript@4.9.5(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyocto-queue@0.1.0(transitive)