CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
README.md62 linesDownload Raw Back to toidentifier
1# toidentifier2 3[![NPM Version][npm-image]][npm-url]4[![NPM Downloads][downloads-image]][downloads-url]5[![Build Status][github-actions-ci-image]][github-actions-ci-url]6[![Test Coverage][codecov-image]][codecov-url]7 8> Convert a string of words to a JavaScript identifier9 10## Install11 12This is a [Node.js](https://nodejs.org/en/) module available through the13[npm registry](https://www.npmjs.com/). Installation is done using the14[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):15 16```bash17$ npm install toidentifier18```19 20## Example21 22```js23var toIdentifier = require('toidentifier')24 25console.log(toIdentifier('Bad Request'))26// => "BadRequest"27```28 29## API30 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 to36the 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## License44 45[MIT](LICENSE)46 47[codecov-image]: https://img.shields.io/codecov/c/github/component/toidentifier.svg48[codecov-url]: https://codecov.io/gh/component/toidentifier49[downloads-image]: https://img.shields.io/npm/dm/toidentifier.svg50[downloads-url]: https://npmjs.org/package/toidentifier51[github-actions-ci-image]: https://img.shields.io/github/workflow/status/component/toidentifier/ci/master?label=ci52[github-actions-ci-url]: https://github.com/component/toidentifier?query=workflow%3Aci53[npm-image]: https://img.shields.io/npm/v/toidentifier.svg54[npm-url]: https://npmjs.org/package/toidentifier55 56 57##58 59[npm]: https://www.npmjs.com/60 61[yarn]: https://yarnpkg.com/62