2019-05-07 07:48:28 +03:00
|
|
|
const _ = require('lodash');
|
|
|
|
const slugify = require('@tryghost/string').slugify;
|
2017-12-14 15:26:48 +03:00
|
|
|
|
|
|
|
module.exports.safe = function safe(string, options) {
|
|
|
|
options = options || {};
|
2019-05-07 07:48:28 +03:00
|
|
|
let opts = {requiredChangesOnly: true};
|
2017-12-14 15:26:48 +03:00
|
|
|
if (!_.has(options, 'importing') || !options.importing) {
|
2019-05-07 07:48:28 +03:00
|
|
|
opts.requiredChangesOnly = false;
|
2017-12-14 15:26:48 +03:00
|
|
|
}
|
2019-05-07 07:48:28 +03:00
|
|
|
return slugify(string, opts);
|
2017-12-14 15:26:48 +03:00
|
|
|
};
|