A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/component/toidentifier below:

component/toidentifier: Convert a string of words to a JavaScript identifier

Convert a string of words to a JavaScript identifier

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install toidentifier
var toIdentifier = require('toidentifier')

console.log(toIdentifier('Bad Request'))
// => "BadRequest"

This CommonJS module exports a single default function: toIdentifier.

Given a string as the argument, it will be transformed according to the following rules and the new string will be returned:

  1. Split into words separated by space characters (0x20).
  2. Upper case the first character of each word.
  3. Join the words together with no separator.
  4. Remove all non-word ([0-9a-z_]) characters.

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4