Skip to content

Commit

Permalink
Refactor helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
cressie176 committed Jan 7, 2024
1 parent d6cb663 commit ac66fa5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const fs = require('node:fs');
const Papa = require('papaparse');

function and(...args) {
return args.every(Boolean);
}

function tableName(name, version) {
return `${name.toLowerCase().replace(/\s/g, '_')}_v${version}`;
}
Expand Down Expand Up @@ -43,19 +47,15 @@ function xvalues(obj, options) {
return Object.values(obj).reduce(toString.bind(options), '');
}

function and(...args) {
return args.every(Boolean);
}

function toString(result, item, index, items) {
const context = { item, isLast: index === items.length - 1 };
return result + this.fn(context);
}

module.exports = {
and,
tableName,
loadCsv,
xkeys,
xvalues,
and,
};

0 comments on commit ac66fa5

Please sign in to comment.