nextalys-js-helpers
Advanced tools
Comparing version
@@ -0,3 +1,4 @@ | ||
/// <reference types="node" /> | ||
export declare class CSVHelpers { | ||
static parseCSVFileInput(fileInput: HTMLInputElement, delimiter?: string, strict?: boolean): Promise<{ | ||
static parseCSVFileInput(fileInput: HTMLInputElement, delimiter?: string, strict?: boolean, encoding?: BufferEncoding): Promise<{ | ||
success: boolean; | ||
@@ -7,3 +8,3 @@ error?: any; | ||
}>; | ||
static parseCSVFile(file: File, delimiter?: string, strict?: boolean): Promise<{ | ||
static parseCSVFile(file: File, delimiter?: string, strict?: boolean, encoding?: BufferEncoding): Promise<{ | ||
success: boolean; | ||
@@ -13,3 +14,3 @@ error?: any; | ||
}>; | ||
static parseCSV(str: string, delimiter?: string, strict?: boolean): Promise<{ | ||
static parseCSV(str: string, delimiter?: string, strict?: boolean, encoding?: BufferEncoding): Promise<{ | ||
success: boolean; | ||
@@ -16,0 +17,0 @@ error?: any; |
@@ -58,3 +58,3 @@ "use strict"; | ||
} | ||
CSVHelpers.parseCSVFileInput = function (fileInput, delimiter, strict) { | ||
CSVHelpers.parseCSVFileInput = function (fileInput, delimiter, strict, encoding) { | ||
var _a; | ||
@@ -66,3 +66,3 @@ if (delimiter === void 0) { delimiter = ';'; } | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.parseCSVFile((_a = fileInput === null || fileInput === void 0 ? void 0 : fileInput.files) === null || _a === void 0 ? void 0 : _a[0], delimiter, strict)]; | ||
case 0: return [4 /*yield*/, this.parseCSVFile((_a = fileInput === null || fileInput === void 0 ? void 0 : fileInput.files) === null || _a === void 0 ? void 0 : _a[0], delimiter, strict, encoding)]; | ||
case 1: return [2 /*return*/, _b.sent()]; | ||
@@ -73,3 +73,3 @@ } | ||
}; | ||
CSVHelpers.parseCSVFile = function (file, delimiter, strict) { | ||
CSVHelpers.parseCSVFile = function (file, delimiter, strict, encoding) { | ||
var _this = this; | ||
@@ -93,3 +93,3 @@ if (delimiter === void 0) { delimiter = ';'; } | ||
text = reader_1.result; | ||
return [4 /*yield*/, this.parseCSV(text, delimiter, strict)]; | ||
return [4 /*yield*/, this.parseCSV(text, delimiter, strict, encoding)]; | ||
case 1: | ||
@@ -110,3 +110,3 @@ response = _a.sent(); | ||
}; | ||
CSVHelpers.parseCSV = function (str, delimiter, strict) { | ||
CSVHelpers.parseCSV = function (str, delimiter, strict, encoding) { | ||
if (delimiter === void 0) { delimiter = ';'; } | ||
@@ -122,2 +122,3 @@ if (strict === void 0) { strict = false; } | ||
relax_column_count: !strict, | ||
encoding: encoding, | ||
}); | ||
@@ -124,0 +125,0 @@ // Use the readable stream api to consume records |
{ | ||
"name": "nextalys-js-helpers", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Nextalys Javascript Helpers", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1236710
0.02%19104
0.01%