mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-29 10:09:24 +01:00
054d124afe
Many thanks to all the other developers who made this possible, especially Shoelace
17 lines
510 B
JavaScript
17 lines
510 B
JavaScript
const slugify = require('slugify');
|
|
|
|
/** Creates a slug from an arbitrary string of text. */
|
|
module.exports.createSlug = function (text) {
|
|
return slugify(String(text), {
|
|
remove: /[^\w|\s]/g,
|
|
lower: true
|
|
});
|
|
};
|
|
|
|
/** Determines whether or not a link is external. */
|
|
module.exports.isExternalLink = function (link) {
|
|
// We use the "internal" hostname when initializing JSDOM so we know that those are local links
|
|
if (!link.hostname || link.hostname === 'internal') return false;
|
|
return true;
|
|
};
|