source: trip-planner-front/node_modules/toidentifier/README.md@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.7 KB
Line 
1# toidentifier
2
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]
7
8> Convert a string of words to a JavaScript identifier
9
10## Install
11
12This 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):
15
16```bash
17$ npm install toidentifier
18```
19
20## Example
21
22```js
23var toIdentifier = require('toidentifier')
24
25console.log(toIdentifier('Bad Request'))
26// => "BadRequest"
27```
28
29## API
30
31This CommonJS module exports a single default function: `toIdentifier`.
32
33### toIdentifier(string)
34
35Given a string as the argument, it will be transformed according to
36the following rules and the new string will be returned:
37
381. Split into words separated by space characters (`0x20`).
392. Upper case the first character of each word.
403. Join the words together with no separator.
414. Remove all non-word (`[0-9a-z_]`) characters.
42
43## License
44
45[MIT](LICENSE)
46
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
55
56
57##
58
59[npm]: https://www.npmjs.com/
60
61[yarn]: https://yarnpkg.com/
Note: See TracBrowser for help on using the repository browser.