0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

refactored security.string to be more readable ()

refs 

- Logic can be simplified
- Add JSDoc types
This commit is contained in:
Vikas Potluri 2022-08-02 04:49:17 -07:00 committed by GitHub
parent 2f1844e7e9
commit bcafb84c44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,9 @@
const slugify = require('@tryghost/string').slugify;
/**
* @param {string} string
* @param {{importing?: boolean}} [options]
*/
module.exports.safe = function safe(string, options = {}) {
let opts = {requiredChangesOnly: true};
if (!('importing' in options) || !options.importing) {
opts.requiredChangesOnly = false;
}
return slugify(string, opts);
return slugify(string, {requiredChangesOnly: options.importing === true});
};