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.

48 lines
781 B

4 years ago
  1. # decamelize [![Build Status](https://travis-ci.org/sindresorhus/decamelize.svg?branch=master)](https://travis-ci.org/sindresorhus/decamelize)
  2. > Convert a camelized string into a lowercased one with a custom separator<br>
  3. > Example: `unicornRainbow` → `unicorn_rainbow`
  4. ## Install
  5. ```
  6. $ npm install --save decamelize
  7. ```
  8. ## Usage
  9. ```js
  10. const decamelize = require('decamelize');
  11. decamelize('unicornRainbow');
  12. //=> 'unicorn_rainbow'
  13. decamelize('unicornRainbow', '-');
  14. //=> 'unicorn-rainbow'
  15. ```
  16. ## API
  17. ### decamelize(input, [separator])
  18. #### input
  19. Type: `string`
  20. #### separator
  21. Type: `string`<br>
  22. Default: `_`
  23. ## Related
  24. See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse.
  25. ## License
  26. MIT © [Sindre Sorhus](https://sindresorhus.com)