Fixed travis checks

This commit is contained in:
Vimal-Raghubir 2018-03-25 20:07:57 -04:00
parent e069ae4991
commit 5bab9b88e8
5 changed files with 62 additions and 62 deletions

View file

@ -331,8 +331,8 @@ const Categories = [
"Extract EXIF", "Extract EXIF",
"Numberwang", "Numberwang",
"XKCD Random Number", "XKCD Random Number",
"Parse CSV to string", "Parse CSV to string",
"Parse string to CSV" "Parse string to CSV"
] ]
}, },
{ {

View file

@ -4020,37 +4020,37 @@ const OperationConfig = {
outputType: "number", outputType: "number",
args: [] args: []
}, },
"CSV To String": { "CSV To String": {
module: "CSVParser", module: "CSVParser",
description: "Function used to parse CSV string to a regular string.", description: "Function used to parse CSV string to a regular string.",
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
args: [ args: [
{ {
name: "delimeter", name: "delimeter",
type: "string", type: "string",
value: "," value: ","
}, },
{ {
name: "quotes", name: "quotes",
type: "string", type: "string",
value: '"' value: '"'
} }
] ]
}, },
"String to CSV": { "String to CSV": {
module: "CSVParser", module: "CSVParser",
description: "Function used to parse a string array to a CSV string.", description: "Function used to parse a string array to a CSV string.",
inputType: "string", inputType: "string",
outputType: "string", outputType: "string",
args: [ args: [
{ {
name: "delimeter", name: "delimeter",
type: "string", type: "string",
value: "," value: ","
} }
] ]
} }
}; };

View file

@ -21,7 +21,7 @@ import PublicKeyModule from "./PublicKey.js";
import RegexModule from "./Regex.js"; import RegexModule from "./Regex.js";
import ShellcodeModule from "./Shellcode.js"; import ShellcodeModule from "./Shellcode.js";
import URLModule from "./URL.js"; import URLModule from "./URL.js";
import CSVModule from "./CSVParser.js" import CSVModule from "./CSVParser.js";
Object.assign( Object.assign(
OpModules, OpModules,
@ -39,7 +39,7 @@ Object.assign(
RegexModule, RegexModule,
ShellcodeModule, ShellcodeModule,
URLModule, URLModule,
CSVModule CSVModule
); );
export default OpModules; export default OpModules;

View file

@ -1,4 +1,4 @@
import { CSV } from 'csv-string'; import { CSV } from "csv-string";
/** /**
* @author VimalRaghubir [vraghubir0418@gmail.com] * @author VimalRaghubir [vraghubir0418@gmail.com]
@ -15,34 +15,34 @@ const CSVParser = {
* @param {Object[]} args * @param {Object[]} args
* @returns {string} * @returns {string}
*/ */
csvToString: function(input, args) { csvToString: function(input, args) {
var array = ""; let array = "";
if (input) { if (input) {
var detectedDelimeter = CSV.detect(input); let detectedDelimeter = CSV.detect(input);
if (detectedDelimeter != args[0]) { if (detectedDelimeter !== args[0]) {
args[0] = detectedDelimeter; args[0] = detectedDelimeter;
} }
array = CSV.parse(input, args[0], args[1]); array = CSV.parse(input, args[0], args[1]);
} else { } else {
array = "The passed in data is not a csv string. Please pass in a csv string."; array = "The passed in data is not a csv string. Please pass in a csv string.";
} }
return array; return array;
}, },
/** /**
* Parse to CSV * Parse to CSV
* @param {string} input * @param {string} input
* @param {Object[]} args * @param {Object[]} args
* @returns {string} * @returns {string}
*/ */
stringToCSV: function(input, args) { stringToCSV: function(input, args) {
var string = ""; let string = "";
if (input) { if (input) {
string = CSV.stringify(input, args[0]); string = CSV.stringify(input, args[0]);
} else { } else {
string = "The passed in data is not a string that can be converted to a CSV."; string = "The passed in data is not a string that can be converted to a CSV.";
} }
return string; return string;
} }
} };
export default CSVParser; export default CSVParser;