Skip to content

handpicked · curated

slugify: add a maxLength option

https://github.com/sindresorhus/slugify @ 99b35c2b0d6ccfad2b96ba9ce6997c6365b9a4b7

public

Language

node

License

MIT

Version

1.0.0

Issue

Add a `maxLength` option to slugify. The returned slug must never be longer than the limit. Truncate to the limit, then remove a trailing separator. If the cut splits a word, prefer cutting at the last separator before it; otherwise hard-truncate the slug. `maxLength: 0` returns an empty string. A negative or non-integer `maxLength` must throw a TypeError. Document the option in `index.d.ts` so the published types match the runtime.

test command (not shown to the agent)

node --test .orivoxx/acceptance.test.mjs

Validation gates

polling

Waiting for the validation worker. This page polls every 3 seconds.

Six gates

cloned
pass
installs
pass
testFailsAtBase
pass
deterministic
pass
timeBounded
pass
licenseOk
pass