1 | 'use strict'
|
2 |
|
3 | const la = require('lazy-ass')
|
4 | const is = require('check-more-types')
|
5 |
|
6 | function stripScope (packageName) {
|
7 | const sep = packageName.indexOf('/')
|
8 | la(is.found(sep), 'could not find / in scoped name', packageName)
|
9 | return packageName.substr(sep + 1)
|
10 | }
|
11 |
|
12 | function withoutScope (packageName) {
|
13 | la(is.unemptyString(packageName), 'expected package name', packageName)
|
14 | if (packageName[0] === '@') {
|
15 | return stripScope(packageName)
|
16 | }
|
17 | return packageName
|
18 | }
|
19 |
|
20 | module.exports = withoutScope
|