get-package-name
Advanced tools
Comparing version 2.1.0 to 2.2.0
10
index.js
@@ -14,8 +14,10 @@ const path = require('path') | ||
if (index > -1) { | ||
const name = segments[index + 1] | ||
const name = segments[index + 1] || '' | ||
const scopedName = segments[index + 2] || '' | ||
if (name[0] === '@') { | ||
const scopedName = segments[index + 2] | ||
return `${name}/${scopedName}` | ||
} else { | ||
return scopedName ? `${name}/${scopedName}` : undefined | ||
} | ||
if (name) { | ||
return name | ||
@@ -22,0 +24,0 @@ } |
{ | ||
"name": "get-package-name", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Get the name of a dependency from a module file path.", | ||
@@ -9,4 +9,5 @@ "main": "index.js", | ||
"test:spec": "jasmine tests/spec.js", | ||
"test:prettier": "prettier --config .prettierrc.json --list-different **/*.js", | ||
"test": "npm run test:prettier && npm run test:spec" | ||
"test:prettier": "prettier --config .prettierrc.json --check *.js **/*.js", | ||
"test": "npm run test:prettier && npm run test:spec", | ||
"format": "prettier --config .prettierrc.json --write *.js **/*.js" | ||
}, | ||
@@ -13,0 +14,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4247
25