Powtórzenie z lekcji 1

This commit is contained in:
floriano committed 2026-09-09 19:31:31 +02:00
1 parent a102c6ea1e
commit 0d1dce5535
625 files changed
+65007

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
/*!
* toidentifier
* Copyright(c) 2016 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* 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, '')
}