Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Readme.md 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Slugg
  2. Make strings url-safe.
  3. - Comprehensive tests
  4. - No dependencies
  5. - Not in coffee-script (lol)
  6. - Coerces foreign symbols to their english equivalent
  7. - Doesn't try to do anything fancy with symbols (just removes them)
  8. - Works in browser (`window.slugg`) and AMD/CommonJS-flavoured module loaders
  9. ```
  10. npm install slugg
  11. ```
  12. ## Usage:
  13. ### slug(string, [separator, toStrip])
  14. ```js
  15. var slug = require('slugg')
  16. slug('My fantastic blog post')
  17. //-> 'my-fantastic-blog-post'
  18. slug('Today I found £5')
  19. //-> 'today-i-found-5'
  20. slug('I ♥ you')
  21. //-> 'i-you'
  22. ```
  23. If you want a separator other than '-', pass it in as the second argument:
  24. ```js
  25. slug('Kevin Spacey', ' ')
  26. //-> 'kevin spacey'
  27. ```
  28. By default, slugg will strip (i.e. remove and not replace) any sort of quotemark: `'"’‘”“`.
  29. If you want to control which characters are stripped, pass a regex as the last option
  30. that will match the chars you want to replace, eg:
  31. ```js
  32. slug('Mum\'s cooking', /'/g)
  33. //-> 'mums-cooking'
  34. ```
  35. Remember to use the `g` flag if you want all the matches stripped (not just the first).
  36. After version 1.1.0, a new syntax has been introduced:
  37. ### slug(string, [options])
  38. If you want a separator other than '-', pass it in as the `separator` option:
  39. ```js
  40. slug('Kevin Spacey', { separator: ' ' })
  41. //-> 'kevin spacey'
  42. ```
  43. If you want to control which characters are stripped, pass a regex as the `toStrip` option
  44. that will match the chars you want to replace, eg:
  45. ```js
  46. slug('Mum\'s cooking', { toStrip: /'/g })
  47. //-> 'mums-cooking'
  48. ```
  49. Remember to use the `g` flag if you want all the matches stripped (not just the first).
  50. By default, slugg will convert your string to lower case. If you want to disable it just
  51. pass the `toLowerCase` option as `false`, eg:
  52. ```js
  53. slug('Slugg rocks!', { toLowerCase: false })
  54. //-> 'Slugg-rocks'
  55. ```