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
optimacms-0.1.61 spec/dummy/node_modules/toidentifier/index.js
disco_app-0.18.0 test/dummy/node_modules/toidentifier/index.js
disco_app-0.18.2 test/dummy/node_modules/toidentifier/index.js
disco_app-0.16.1 test/dummy/node_modules/toidentifier/index.js
disco_app-0.15.2 test/dummy/node_modules/toidentifier/index.js
disco_app-0.18.4 test/dummy/node_modules/toidentifier/index.js
disco_app-0.18.1 test/dummy/node_modules/toidentifier/index.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/toidentifier/index.js
disco_app-0.14.0 test/dummy/node_modules/toidentifier/index.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/toidentifier/index.js
tang-0.2.1 spec/tang_app/node_modules/toidentifier/index.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/toidentifier/index.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/toidentifier/index.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/toidentifier/index.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/toidentifier/index.js
tang-0.2.0 spec/tang_app/node_modules/toidentifier/index.js
tang-0.1.0 spec/tang_app/node_modules/toidentifier/index.js
tang-0.0.9 spec/tang_app/node_modules/toidentifier/index.js
enju_library-0.3.8 spec/dummy/node_modules/toidentifier/index.js
ilog-0.4.1 node_modules/toidentifier/index.js