Skip to content

Commit 4a962c7

Browse files
committed
fix: reject leading hyphens
1 parent 39a48ef commit 4a962c7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ function validate (name) {
3434
errors.push('name cannot start with a period')
3535
}
3636

37+
if (name.startsWith('-')) {
38+
errors.push('name cannot start with a hyphen')
39+
}
40+
3741
if (name.match(/^_/)) {
3842
errors.push('name cannot start with an underscore')
3943
}

0 commit comments

Comments
 (0)