Você não pode selecionar mais de 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.

5 anos atrás
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # toidentifier
  2. [![NPM Version][npm-image]][npm-url]
  3. [![NPM Downloads][downloads-image]][downloads-url]
  4. [![Build Status][travis-image]][travis-url]
  5. [![Test Coverage][codecov-image]][codecov-url]
  6. > Convert a string of words to a JavaScript identifier
  7. ## Install
  8. This is a [Node.js](https://nodejs.org/en/) module available through the
  9. [npm registry](https://www.npmjs.com/). Installation is done using the
  10. [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
  11. ```bash
  12. $ npm install toidentifier
  13. ```
  14. ## Example
  15. ```js
  16. var toIdentifier = require('toidentifier')
  17. console.log(toIdentifier('Bad Request'))
  18. // => "BadRequest"
  19. ```
  20. ## API
  21. This CommonJS module exports a single default function: `toIdentifier`.
  22. ### toIdentifier(string)
  23. Given a string as the argument, it will be transformed according to
  24. the following rules and the new string will be returned:
  25. 1. Split into words separated by space characters (`0x20`).
  26. 2. Upper case the first character of each word.
  27. 3. Join the words together with no separator.
  28. 4. Remove all non-word (`[0-9a-z_]`) characters.
  29. ## License
  30. [MIT](LICENSE)
  31. [codecov-image]: https://img.shields.io/codecov/c/github/component/toidentifier.svg
  32. [codecov-url]: https://codecov.io/gh/component/toidentifier
  33. [downloads-image]: https://img.shields.io/npm/dm/toidentifier.svg
  34. [downloads-url]: https://npmjs.org/package/toidentifier
  35. [npm-image]: https://img.shields.io/npm/v/toidentifier.svg
  36. [npm-url]: https://npmjs.org/package/toidentifier
  37. [travis-image]: https://img.shields.io/travis/component/toidentifier/master.svg
  38. [travis-url]: https://travis-ci.org/component/toidentifier
  39. ##
  40. [npm]: https://www.npmjs.com/
  41. [yarn]: https://yarnpkg.com/