Ghost/ghost/api-framework/lib/utils/options.js
Daniel Lockyer 687e68d5de Extracted shared API framework to separate package
refs https://github.com/TryGhost/Toolbox/issues/363

- this API framework is standalone and should be pulled out into a
  separate package so we can define its boundaries more clearly, and
  promote better testing of smaller parts
2022-08-11 17:44:59 +02:00

24 lines
475 B
JavaScript

const _ = require('lodash');
/**
* @description Helper function to prepare params for internal usages.
*
* e.g. "a,B,c" -> ["a", "b", "c"]
*
* @param {String} params
* @return {Array}
*/
const trimAndLowerCase = (params) => {
params = params || '';
if (_.isString(params)) {
params = params.split(',');
}
return params.map((item) => {
return item.trim().toLowerCase();
});
};
module.exports.trimAndLowerCase = trimAndLowerCase;