Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
🐛 bug(core): Normalize scoped names in build (#13) by @d0whc3r
Browse files Browse the repository at this point in the history
* Normalize scoped names in build

* Change stripNamespaceIfExists function

Include check for empty name in stripNamespaceIfExists function

* use "isDef" in stripNamespaceIfExists function

* Update code style
  • Loading branch information
d0whc3r authored and kazupon committed Feb 20, 2019
1 parent 0e91794 commit 6439350
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function normalizeModuleName (name) {
if (!isDef(name)) {
log(`⚠️ ${chalk.yellow.bold('name')} is undefined in ${chalk.yellow.bold('package.json')}`)
}
return name
return stripNamespaceIfExists(name)
}

function normalizeLicense (license) {
Expand Down Expand Up @@ -74,8 +74,10 @@ function normalizeAuthor (_author) {
}

function stripNamespaceIfExists (name) {
if (name.indexOf('@') === -1) return name;
return name.split('/').slice(-1).join('');
if (!isDef(name) || name.indexOf('@') < 0) {
return name
}
return name.split('/').slice(-1).join('')
}

module.exports = {
Expand Down

0 comments on commit 6439350

Please sign in to comment.