Ghost/ghost/members-csv/parse
Nazar Gargol 08600f05c7 Extracted members csv input serialization logic into separate module
refs 772ec13ac49a1d80877bb7b0f90ad57899f868dd

- This is prep work for extraction into members repository.
2020-06-19 19:33:43 +12:00

37 lines
809 B
Plaintext

const fsLib = require('../../../../../../lib/fs');
const parse = async (filePath) => {
const columnsToExtract = [{
name: 'email',
lookup: /^email/i
}, {
name: 'name',
lookup: /name/i
}, {
name: 'note',
lookup: /note/i
}, {
name: 'subscribed_to_emails',
lookup: /subscribed_to_emails/i
}, {
name: 'stripe_customer_id',
lookup: /stripe_customer_id/i
}, {
name: 'complimentary_plan',
lookup: /complimentary_plan/i
}, {
name: 'labels',
lookup: /labels/i
}, {
name: 'created_at',
lookup: /created_at/i
}];
return await fsLib.readCSV({
path: filePath,
columnsToExtract: columnsToExtract
});
};
module.exports.parse = parse;