版博士V2.0程序
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

README.md 2.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # 🧵 Scule
  2. [![npm version][npm-version-src]][npm-version-href]
  3. [![npm downloads][npm-downloads-src]][npm-downloads-href]
  4. [![Github Actions][github-actions-src]][github-actions-href]
  5. [![Codecov][codecov-src]][codecov-href]
  6. [![bundle][bundle-src]][bundle-href]
  7. <!-- ![](.github/banner.svg) -->
  8. ## Install
  9. Install using npm or yarn:
  10. ```bash
  11. npm i scule
  12. # or
  13. yarn add scule
  14. ```
  15. Import:
  16. ```js
  17. // CommonJS
  18. const { pascalCase } = require('scule')
  19. // ESM
  20. import { pascalCase } from 'scule'
  21. ```
  22. **Notice:** You may need to transpile package for legacy environments
  23. ## Utils
  24. ### `pascalCase(str)`
  25. Splits string and joins by PascalCase convention (`foo-bar` => `FooBar`)
  26. **Remarks:**
  27. - If an uppercase letter is followed by other uppercase letters (like `FooBAR`), they are preserved
  28. ### `camelCase`
  29. Splits string and joins by camelCase convention (`foo-bar` => `fooBar`)
  30. ### `kebabCase(str)`
  31. Splits string and joins by kebab-case convention (`fooBar` => `foo-bar`)
  32. **Remarks:**
  33. - It does **not** preserve case
  34. ### `snakeCase`
  35. Splits string and joins by snake_case convention (`foo-bar` => `foo_bar`)
  36. ### `upperFirst(str)`
  37. Converts first character to upper case
  38. ### `lowerFirst(str)`
  39. Converts first character to lower case
  40. ### `splitByCase(str, splitters?)`
  41. - Splits string by the splitters provided (default: `['-', '_', '/', '.]`)
  42. - Splits when case changes from lower to upper or upper to lower
  43. - Ignores numbers for case changes
  44. - Case is preserved in returned value
  45. - Is an irreversible function since splitters are omitted
  46. ## License
  47. [MIT](./LICENSE)
  48. <!-- Badges -->
  49. [npm-version-src]: https://img.shields.io/npm/v/scule?style=flat-square
  50. [npm-version-href]: https://npmjs.com/package/scule
  51. [npm-downloads-src]: https://img.shields.io/npm/dm/scule?style=flat-square
  52. [npm-downloads-href]: https://npmjs.com/package/scule
  53. [github-actions-src]: https://img.shields.io/github/workflow/status/unjs/scule/ci/main?style=flat-square
  54. [github-actions-href]: https://github.com/unjs/scule/actions?query=workflow%3Aci
  55. [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/scule/main?style=flat-square
  56. [codecov-href]: https://codecov.io/gh/unjs/scule
  57. [bundle-src]: https://img.shields.io/bundlephobia/minzip/scule?style=flat-square
  58. [bundle-href]: https://bundlephobia.com/result?p=scule