-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c84b3ba
commit 363c96f
Showing
8 changed files
with
30 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
declare const isScoped: { | ||
/** | ||
Check if a string is a [scoped npm package name](https://docs.npmjs.com/misc/scope). | ||
/** | ||
Check if a string is a [scoped npm package name](https://docs.npmjs.com/misc/scope). | ||
@example | ||
``` | ||
import isScoped = require('is-scoped'); | ||
@example | ||
``` | ||
import isScoped from 'is-scoped'; | ||
isScoped('@sindresorhus/df'); | ||
//=> true | ||
isScoped('@sindresorhus/df'); | ||
//=> true | ||
isScoped('cat-names'); | ||
//=> false | ||
``` | ||
*/ | ||
(input: string): boolean; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function isScoped(input: string): boolean; | ||
// export = isScoped; | ||
default: typeof isScoped; | ||
}; | ||
|
||
export = isScoped; | ||
isScoped('cat-names'); | ||
//=> false | ||
``` | ||
*/ | ||
export default function isScoped(string: string): boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
'use strict'; | ||
const scopedRegex = require('scoped-regex'); | ||
import scopedRegex from 'scoped-regex'; | ||
|
||
const isScoped = input => scopedRegex({exact: true}).test(input); | ||
|
||
module.exports = isScoped; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = isScoped; | ||
export default function isScoped(string) { | ||
return scopedRegex({exact: true}).test(string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import {expectType} from 'tsd'; | ||
import isScoped = require('.'); | ||
import isScoped from './index.js'; | ||
|
||
expectType<boolean>(isScoped('is-scoped')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters