Sha256: 6df7c8b218f33abc33563a33de06b4bbb1a43a6232b4c31cb01c55c38ed1cba8

Contents?: true

Size: 490 Bytes

Versions: 29

Compression:

Stored size: 490 Bytes

Contents

/*!
 * toidentifier
 * Copyright(c) 2016 Douglas Christopher Wilson
 * MIT Licensed
 */

/**
 * Module exports.
 * @public
 */

module.exports = toIdentifier

/**
 * Trasform the given string into a JavaScript identifier
 *
 * @param {string} str
 * @returns {string}
 * @public
 */

function toIdentifier (str) {
  return str
    .split(' ')
    .map(function (token) {
      return token.slice(0, 1).toUpperCase() + token.slice(1)
    })
    .join('')
    .replace(/[^ _0-9a-z]/gi, '')
}

Version data entries

29 entries across 28 versions & 9 rubygems

Version Path
ilog-0.4.0 node_modules/toidentifier/index.js
ilog-0.3.3 node_modules/toidentifier/index.js
jester-data-8.0.0 node_modules/toidentifier/index.js
ezii-os-5.2.1 node_modules/toidentifier/index.js
ezii-os-2.0.1 node_modules/toidentifier/index.js
ezii-os-1.1.0 node_modules/toidentifier/index.js
ezii-os-1.0.0 node_modules/toidentifier/index.js
ezii-os-0.0.0.1.0 node_modules/toidentifier/index.js
ezii-os-0.0.0.0.1 node_modules/toidentifier/index.js