Files
shoelace/docs/_utilities/strings.js
2024-03-07 12:42:30 -05:00

17 lines
449 B
JavaScript

import slugify from 'slugify';
/** Creates a slug from an arbitrary string of text. */
export function createSlug(text) {
return slugify(String(text), {
remove: /[^\w|\s]/g,
lower: true
});
}
/** Determines whether or not a link is external. */
export function isExternalLink(link) {
// We use the "internal" hostname when initializing JSDOM so we know that those are local links
if (!link.hostname) return false;
return true;
}