{"id":13508632,"url":"https://github.com/simov/slugify","last_synced_at":"2025-04-28T15:43:32.707Z","repository":{"id":523889,"uuid":"8038947","full_name":"simov/slugify","owner":"simov","description":"Slugifies a string","archived":false,"fork":false,"pushed_at":"2024-10-05T14:41:01.000Z","size":168,"stargazers_count":1638,"open_issues_count":43,"forks_count":130,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-27T07:37:16.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-02-05T21:49:34.000Z","updated_at":"2025-04-22T14:26:47.000Z","dependencies_parsed_at":"2024-10-20T13:45:33.910Z","dependency_job_id":null,"html_url":"https://github.com/simov/slugify","commit_stats":{"total_commits":171,"total_committers":42,"mean_commits":4.071428571428571,"dds":"0.38596491228070173","last_synced_commit":"c99c574fcbd3468e380ecbda46a6d157da261d74"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fslugify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fslugify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fslugify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simov%2Fslugify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simov","download_url":"https://codeload.github.com/simov/slugify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251302781,"owners_count":21567601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T02:00:55.943Z","updated_at":"2025-04-28T15:43:32.683Z","avatar_url":"https://github.com/simov.png","language":"JavaScript","readme":"\n# slugify\n\n[![npm-version]][npm] [![coveralls-status]][coveralls]\n\n```js\nvar slugify = require('slugify')\n\nslugify('some string') // some-string\n\n// if you prefer something other than '-' as separator\nslugify('some string', '_')  // some_string\n```\n\n- Vanilla ES2015 JavaScript\n    - If you need to use Slugify with older browsers, consider using [version 1.4.7](https://github.com/simov/slugify/releases/tag/v1.4.7)\n- No dependencies\n- Coerces foreign symbols to their English equivalent (check out the [charMap][charmap] for more details)\n- Works in the browser (window.slugify) and AMD/CommonJS-flavored module loaders\n\n## Options\n\n```js\nslugify('some string', {\n  replacement: '-',  // replace spaces with replacement character, defaults to `-`\n  remove: undefined, // remove characters that match regex, defaults to `undefined`\n  lower: false,      // convert to lower case, defaults to `false`\n  strict: false,     // strip special characters except replacement, defaults to `false`\n  locale: 'vi',      // language code of the locale to use\n  trim: true         // trim leading and trailing replacement chars, defaults to `true`\n})\n```\n\n## Remove\n\nFor example, to remove `*+~.()'\"!:@` from the result slug, you can use `slugify('..', {remove: /[*+~.()'\"!:@]/g})`.\n\n* If the value of `remove` is a regular expression, it should be a\n  [character class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes)\n  and only a character class. It should also use the\n  [global flag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global).\n  (For example: `/[*+~.()'\"!:@]/g`.) Otherwise, the `remove` option might not\n  work as expected.\n* If the value of `remove` is a string, it should be a single character.\n  Otherwise, the `remove` option might not work as expected.\n\n## Locales\n\nThe main `charmap.json` file contains all known characters and their transliteration. All new characters should be added there first. In case you stumble upon a character already set in `charmap.json`, but not transliterated correctly according to your language, then you have to add those characters in `locales.json` to override the already existing transliteration in `charmap.json`, but for your locale only.\n\nYou can get the correct language code of your language from [here](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).\n\n## Extend\n\nOut of the box `slugify` comes with support for a handful of Unicode symbols. For example the `☢` (radioactive) symbol is not defined in the [`charMap`][charmap] and therefore it will be stripped by default:\n\n```js\nslugify('unicode ♥ is ☢') // unicode-love-is\n```\n\nHowever you can extend the supported symbols, or override the existing ones with your own:\n\n```js\nslugify.extend({'☢': 'radioactive'})\nslugify('unicode ♥ is ☢') // unicode-love-is-radioactive\n```\n\nKeep in mind that the `extend` method extends/overrides the default `charMap` for the entire process. In case you need a fresh instance of the slugify's `charMap` object you have to clean up the module cache first:\n\n```js\ndelete require.cache[require.resolve('slugify')]\nvar slugify = require('slugify')\n```\n\n## Contribute\n\n1. Add chars to `charmap.json`\n2. Run tests `npm test`\n3. The tests will build the charmap in `index.js` and will sort the `charmap.json`\n4. Commit **all** modified files\n\n---\n\n\u003e Originally this was a vanilla javascript port of [node-slug][node-slug].\u003cbr\u003e\n\u003e Note that the original [slug][slug] module has been ported to vanilla javascript too.\n\n\n  [npm-version]: https://img.shields.io/npm/v/slugify.svg?style=flat-square (NPM Package Version)\n  [coveralls-status]: https://img.shields.io/coveralls/simov/slugify.svg?style=flat-square (Test Coverage - Coveralls)\n\n  [npm]: https://www.npmjs.com/package/slugify\n  [coveralls]: https://coveralls.io/r/simov/slugify?branch=master\n\n  [node-slug]: https://github.com/dodo/node-slug\n  [slug]: https://www.npmjs.com/package/slug\n  [unicode]: https://www.npmjs.com/package/unicode\n  [index]: https://github.com/simov/slugify/blob/master/index.js\n  [charmap]: https://github.com/simov/slugify/blob/master/config/charmap.json\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimov%2Fslugify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimov%2Fslugify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimov%2Fslugify/lists"}