Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ais-one committed Oct 10, 2023
1 parent ba62192 commit 57d867a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libs/esm/json2csv.js → libs/esm/csv-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function arrayToCsv({ row, delimCol = DELIM_COL }) {
console.log(row)
return '"' + row.join(`"${delimCol}"`) + '"'
}
function json2csv({ _json, delimCol = DELIM_COL, delimRow = DELIM_ROW }) {

function jsonToCsv({ _json, delimCol = DELIM_COL, delimRow = DELIM_ROW }) {
let csv = ''
let headers = []
// let colCount = 0 // check column counts match if not throw error?
Expand All @@ -61,7 +62,7 @@ function json2csv({ _json, delimCol = DELIM_COL, delimRow = DELIM_ROW }) {
return csv
}

function csv2json({ _text, delimCol = DELIM_COL}) {
function csvToJson({ _text, delimCol = DELIM_COL}) {
// converting csv to json...
const arr = csvToArray({ text: _text, delimCol })
const headers = arr.shift() // 1st row is the headers
Expand Down Expand Up @@ -113,10 +114,10 @@ const testString = [
// ]

function testJsonCsv () {
const _csv = json2csv({ _json: testString })
const _csv = jsonToCsv({ _json: testString })
console.log(_csv)

const _json = csv2json({ _text: _csv })
const _json = csvToJson({ _text: _csv })
console.log(_json)
}

Expand Down Expand Up @@ -144,6 +145,8 @@ function testArrayCsv () {
// "11,22,33,"",""44",456,"hello, world" // now how to parse field delimiter

export {
json2csv,
csv2json
jsonToCsv,
csvToJson,
csvToArray,
arrayToCsv
}
3 changes: 3 additions & 0 deletions libs/esm/log-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// console[type] = function logError() {
// orig.apply(console, [`[${new Date().toISOString().replace("T", " ").replace(/\..+/, "")}]`, ...arguments])
// }
//
// Usage (filter out console.log): LogFilter(['log'])

const LogFilter = (function () {
return function (list) {
if (list && list.length) {
Expand Down

0 comments on commit 57d867a

Please sign in to comment.