mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
a31ed7c71d
no issue - jsdoc - added more information & context
24 lines
475 B
JavaScript
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;
|