-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
- Loading branch information
1 parent
819869f
commit cbcb463
Showing
3 changed files
with
32 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
Returns `true` if the given `moduleName` is a Node.js builtin module, `false` otherwise. | ||
@param moduleName - The name of the module. | ||
@example | ||
``` | ||
import isBuiltinModule = require('is-builtin-module'); | ||
isBuiltinModule('fs/promises'); | ||
//=> true | ||
isBuiltinModule('node:fs'); | ||
//=> true | ||
isBuiltinModule('unicorn'); | ||
//=> false | ||
``` | ||
*/ | ||
declare function isBuiltinModule(moduleName: string): boolean; | ||
|
||
export = isBuiltinModule; |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {expectType, expectError} from 'tsd'; | ||
import isBuiltinModule = require('.'); | ||
|
||
expectType<(moduleName: string) => boolean>(isBuiltinModule); | ||
expectError<() => boolean>(isBuiltinModule); |
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