How to use the slug.toLocaleLowerCase function in slug

To help you get started, we’ve selected a few slug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github crabjs / crabjs-cms / administrator / modules / default_cms / controllers / articles.js View on Github external
_module.update = function (req, res) {
    if (!req.body.alias) req.body.alias = require('slug')(req.body.title).toLocaleLowerCase();
    if (typeof req.body.category_id == 'string') {
        req.body.category_id = [req.body.category_id]
    }
    if (typeof req.body.tags == 'string') {
        req.body.tags = [req.body.tags]
    }

    if (!req.body.category_id) {
        req.body.category_id = []
    }

    __models.Posts.update({key: 'article', _id: req.params.id}, req.body).exec(function (err, re) {
        if (err) {
            __.logger.error(err);
            return _module.render_error(req, res, '500');
        }

slug

slugifies even utf-8 chars!

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis