Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcardama/deno_slugify
A string slugifier
https://github.com/jcardama/deno_slugify
deno slugify string-manipulation
Last synced: about 1 month ago
JSON representation
A string slugifier
- Host: GitHub
- URL: https://github.com/jcardama/deno_slugify
- Owner: jcardama
- License: mit
- Created: 2019-05-23T16:08:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-04T21:49:43.000Z (about 4 years ago)
- Last Synced: 2024-10-28T12:15:33.110Z (about 2 months ago)
- Topics: deno, slugify, string-manipulation
- Language: TypeScript
- Size: 36.1 KB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - deno-slugify - Deno的字符串节流器。 (Uncategorized / Uncategorized)
- awesome-deno-cn - @jcardama/deno-slugify
- awesome-deno - deno-slugify - A string slugifier for deno.![GitHub stars](https://img.shields.io/github/stars/jcardama/deno_slugify?style=plastic) (Modules / Online Playgrounds)
- awesome-deno - deno-slugify - A string slugifier for deno. (Modules / String utils)
README
# Deno Slugify [![Build Status](https://github.com/jcardama/deno_slugify/workflows/CI/badge.svg?branch=master&event=push)](ttps://github.com/jcardama/deno_slugify/actions) [![Build Status](https://travis-ci.org/jcardama/deno_slugify.svg?branch=master)](https://travis-ci.org/jcardama/deno_slugify)
A string slugifier
```js
import { slugify } from "https://deno.land/x/slugify/mod.ts";slugify('some string') // some-string
// if you prefer something other than '-' as separator
slugify('some string', '_') // some_string
```## Options
```js
slugify('some string', {
replacement: '-', // replace spaces with replacement
remove: null, // regex to remove characters
lower: true // result in lower case
})
```## Extend
Out of the box `slugify` comes with support for a handful of Unicode symbols. For example the `☢` (radioactive) symbol is not defined in the `charMap` object in [index.js][index] and therefore it will be stripped by default:
```js
slugify('unicode ♥ is ☢') // unicode-love-is
```However you can extend the supported symbols, or override the existing ones with your own:
```js
slugify.extend({'☢': 'radioactive'})
slugify('unicode ♥ is ☢') // unicode-love-is-radioactive
```Keep in mind that the `extend` method extends/overrides the default `charMap` for the entire process.