'use strict';

function slugify(string, encode = false, delimiter = '-') {
    const slug = string.trim().toLowerCase().match(/\w+/g).join(delimiter);

    return encode ? encodeURI(slug) : slug;
}

module.exports = slugify;
