@feelinglovelynow/slug
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

🕉 @feelinglovelynow/slug

💎 Install

pnpm add @feelinglovelynow/slug

🤓 Unit Tests

Statements

🙏 Description

  • Helper function to create a slug (does not require Svelte) and a Svelte component to generate slugs in the browser (requires Svelte)
  • Converts Hello World 123! to hello-world-123

💚 How it works

  1. Lowercase all letters
  2. Remove anything that is not a space, a-z, or 0-9
  3. Remove space at end and beginning
  4. IF two or more spaces found next to each other, convert to one space
  5. Convert spaces to dashes

💛 Example: Slug function

import { slug } from '@feelinglovelynow/slug'

// foo-bar-hello-world-123
const response = slug(' ,.:foo ?!½)(@#$%^&*   ;\'"{}[]|/`~bar    <>_=+&¢£¥hello €© world®    123™·’\\ ')

🧡 Example: Slug component

<script lang="ts">
  import { Slug } from '@feelinglovelynow/slug'
</script>

<Slug />

❤️ Add custom styling to svelte component

.fln__slug {

  textarea {

  }

  &__generated {

  }
}

🎁 All Our Packages

  1. @feelinglovelynow/datetime-local: NPMGithub
  2. @feelinglovelynow/dgraph: NPMGithub
  3. @feelinglovelynow/env-write: NPMGithub
  4. @feelinglovelynow/get-form-entries: NPMGithub
  5. @feelinglovelynow/get-relative-time: NPMGithub
  6. @feelinglovelynow/global-style: NPMGithub
  7. @feelinglovelynow/jwt: NPMGithub
  8. @feelinglovelynow/loop-backwards: NPMGithub
  9. @feelinglovelynow/slug: NPMGithub
  10. @feelinglovelynow/svelte-catch: NPMGithub
  11. @feelinglovelynow/svelte-kv: NPMGithub
  12. @feelinglovelynow/svelte-loading-anchor: NPMGithub
  13. @feelinglovelynow/svelte-modal: NPMGithub
  14. @feelinglovelynow/svelte-turnstile: NPMGithub
  15. @feelinglovelynow/toast: NPMGithub

Package Sidebar

Install

npm i @feelinglovelynow/slug

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

13.7 kB

Total Files

24

Last publish

Collaborators

  • feelinglovelynow