Added JSDoc to members csv parser

refs https://github.com/TryGhost/Toolbox/issues/430

- Typings make developer's life nicer
This commit is contained in:
Naz 2022-10-13 12:16:35 +08:00
parent 1c746c0ca0
commit 971a562b46
No known key found for this signature in database

View File

@ -3,6 +3,13 @@ const pump = require('pump');
const papaparse = require('papaparse');
const fs = require('fs-extra');
/**
*
* @param {string} path - The path to the CSV to prepare
* @param {Object.<string, string>} mapping - An object whose keys are headers in the input CSV and values are the header to replace it with
* @param {Array<string>} [defaultLabels] - A list of labels to apply to every parsed member row
* @returns
*/
module.exports = (path, mapping, defaultLabels = []) => {
const inputMapping = Object.assign({}, mapping, {
subscribed_to_emails: 'subscribed'