diff --git a/HISTORY.md b/HISTORY.md index 7228684..f39d711 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +Unreleased changes +================== + + * improve toClassName function readability and JSDoc completeness + 2.0.0 / 2021-12-17 ================== diff --git a/index.js b/index.js index c425f1e..82271f6 100644 --- a/index.js +++ b/index.js @@ -279,11 +279,12 @@ function populateConstructorExports (exports, codes, HttpError) { /** * Get a class name from a name identifier. + * + * @param {string} name + * @returns {string} * @private */ function toClassName (name) { - return name.substr(-5) !== 'Error' - ? name + 'Error' - : name + return name.slice(-5) === 'Error' ? name : name + 'Error' }