1.1.1 โ€ข Published 5 months ago

@feelinglovelynow/slug v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

๐Ÿ•‰ @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: NPM โ‹… Github
  2. @feelinglovelynow/dgraph: NPM โ‹… Github
  3. @feelinglovelynow/env-write: NPM โ‹… Github
  4. @feelinglovelynow/get-form-entries: NPM โ‹… Github
  5. @feelinglovelynow/get-relative-time: NPM โ‹… Github
  6. @feelinglovelynow/global-style: NPM โ‹… Github
  7. @feelinglovelynow/jwt: NPM โ‹… Github
  8. @feelinglovelynow/loop-backwards: NPM โ‹… Github
  9. @feelinglovelynow/slug: NPM โ‹… Github
  10. @feelinglovelynow/svelte-catch: NPM โ‹… Github
  11. @feelinglovelynow/svelte-kv: NPM โ‹… Github
  12. @feelinglovelynow/svelte-loading-anchor: NPM โ‹… Github
  13. @feelinglovelynow/svelte-modal: NPM โ‹… Github
  14. @feelinglovelynow/svelte-turnstile: NPM โ‹… Github
  15. @feelinglovelynow/toast: NPM โ‹… Github
1.1.1

5 months ago

1.1.0

5 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

7 months ago