
Security News
OpenClaw Advisory Surge Highlights Gaps Between GHSA and CVE Tracking
A recent burst of security disclosures in the OpenClaw project is drawing attention to how vulnerability information flows across advisory and CVE systems.
objection-slug
Advanced tools
This plugin will automatically generate slugs for your model based on a source field and a slug field. It will ensure that the slugs are unique by checking to see if the slug already exists in the model's table. If so, it will attempt to append a number to the end of the slug.
For example, if the source field is 'How to Fry an Egg', then the slug will be
'how-to-fry-an-egg'. However, if that slug already exists in the model's table
then the slug will be 'how-to-fry-an-egg-1' (note that -1 was appended).
And if that slug also exists, then the slug would be
'how-to-fry-an-egg-2' and so on...
npm install objection-slug
This package was inspired by
objection-slugify but it's
different in the following ways:
Appends a number instead of a UUID.
Instead of attempting to append a UUID to the end of the slug, which does not look nice, this package appends a sequential number to the end of duplicate slugs.
Removed unwanted features
There are several options which aren't useful and were removed. For example, instead of changing the slug when the source field changes (which breaks any URLs based on the slug, which is very bad for SEO), this package never changes the slug after it is generated.
Handles many more unicode symbols by default, because it uses the mollusc
library instead of slugify.
const objectionSlug = require('objection-slug')
const { Model } = require('objection')
// Create the mixin
const slug = objectionSlug({
sourceField: 'title',
slugField: 'slug'
})
// Create the Model and add the mixin
class Post extends slug(Model) {
// ...code
}
const post = await Post
.query()
.insert({ title: 'How to Fry an Egg' })
console.log(post.slug)
// how-to-fry-an-egg
slug = objectionSlug([opts])Create a slug mixin to be used with Objection.js models. See usage example above.
opts.sourceField (required)The source of the slugged content.
opts.slugField (defaults to 'slug')The field to store the slug on.
MIT. Copyright (c) Feross Aboukhadijeh.
FAQs
Automatically generate slugs for an Objection.js model
We found that objection-slug demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A recent burst of security disclosures in the OpenClaw project is drawing attention to how vulnerability information flows across advisory and CVE systems.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.