3 [![NPM Version][npm-image]][npm-url]
4 [![NPM Downloads][downloads-image]][downloads-url]
5 [![Build Status][travis-image]][travis-url]
6 [![Test Coverage][codecov-image]][codecov-url]
8 > Convert a string of words to a JavaScript identifier
12 This is a [Node.js](https://nodejs.org/en/) module available through the
13 [npm registry](https://www.npmjs.com/). Installation is done using the
14 [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
17 $ npm install toidentifier
23 var toIdentifier = require('toidentifier')
25 console.log(toIdentifier('Bad Request'))
31 This CommonJS module exports a single default function: `toIdentifier`.
33 ### toIdentifier(string)
35 Given a string as the argument, it will be transformed according to
36 the following rules and the new string will be returned:
38 1. Split into words separated by space characters (`0x20`).
39 2. Upper case the first character of each word.
40 3. Join the words together with no separator.
41 4. Remove all non-word (`[0-9a-z_]`) characters.
47 [codecov-image]: https://img.shields.io/codecov/c/github/component/toidentifier.svg
48 [codecov-url]: https://codecov.io/gh/component/toidentifier
49 [downloads-image]: https://img.shields.io/npm/dm/toidentifier.svg
50 [downloads-url]: https://npmjs.org/package/toidentifier
51 [npm-image]: https://img.shields.io/npm/v/toidentifier.svg
52 [npm-url]: https://npmjs.org/package/toidentifier
53 [travis-image]: https://img.shields.io/travis/component/toidentifier/master.svg
54 [travis-url]: https://travis-ci.org/component/toidentifier
59 [npm]: https://www.npmjs.com/
61 [yarn]: https://yarnpkg.com/