Skip to content

Commit 511ebe6

Browse files
niftylettucedougwilson
authored andcommitted
Use "toidentifier" module to make class names
closes #44
1 parent 6f10484 commit 511ebe6

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ unreleased
22
==========
33

44
* Set constructor name when possible
5+
* Use `toidentifier` module to make class names
56
* deps: statuses@'>= 1.5.0 < 2'
67

78
2018-03-29 / 1.6.3

index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var deprecate = require('depd')('http-errors')
1616
var setPrototypeOf = require('setprototypeof')
1717
var statuses = require('statuses')
1818
var inherits = require('inherits')
19+
var toIdentifier = require('toidentifier')
1920

2021
/**
2122
* Module exports.
@@ -263,14 +264,3 @@ function populateConstructorExports (exports, codes, HttpError) {
263264
exports["I'mateapot"] = deprecate.function(exports.ImATeapot,
264265
'"I\'mateapot"; use "ImATeapot" instead')
265266
}
266-
267-
/**
268-
* Convert a string of words to a JavaScript identifier.
269-
* @private
270-
*/
271-
272-
function toIdentifier (str) {
273-
return str.split(' ').map(function (token) {
274-
return token.slice(0, 1).toUpperCase() + token.slice(1)
275-
}).join('').replace(/[^ _0-9a-z]/gi, '')
276-
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"depd": "~1.1.2",
1414
"inherits": "2.0.3",
1515
"setprototypeof": "1.1.0",
16-
"statuses": ">= 1.5.0 < 2"
16+
"statuses": ">= 1.5.0 < 2",
17+
"toidentifier": "1.0.0"
1718
},
1819
"devDependencies": {
1920
"eslint": "4.19.1",

0 commit comments

Comments
 (0)