Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
module: add isBuiltin method#43396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
module: add isBuiltin method #43396
Changes from all commits
Commits
Show all changes
24 commits Select commit Hold shift + click to select a range
ec1f95a module: add isBuiltIn method
hemanth 2376045 Use regex instead
hemanth 06c135a using primordial instead
hemanth 62a4280 importing StringPrototypeReplace
hemanth 57f5686 doc: add isBuiltIn
hemanth 55916da fix: use String
hemanth 075ae02 using the placeholder REPLACEME
hemanth 7a08b8f prefix to tests
hemanth 8c78587 avoid reassigning function args
hemanth cfc1a07 fix: falsy value assertion
hemanth 8ab8589 fix: also support scheme only modules
hemanth deb9010 removed auto imported console.
hemanth 420c8eb fix: prefix only module checks
hemanth 4bab085 proper check for prefixes
hemanth 9a4fe4a Update lib/internal/modules/cjs/loader.js
hemanth 3b2cd57 Update test/parallel/test-module-isBuiltIn.js
hemanth eafd131 fix: using Set for better perf
hemanth 1e81d07 fix: avoid mutation
hemanth 0910fe0 use slice rather
hemanth 1e7b74f fix: avoid assignment.
hemanth 15b71f3 allBuiltins as a Set
hemanth 70e823a chore: naming it isBuiltin instead & using flatMap
hemanth fc63117 doc: isBuiltin
hemanth b6033d2 chore: rename to isBuiltin
hemanth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,16 @@ | ||
| 'use strict' | ||
| require('../common'); | ||
| const assert = require('assert'); | ||
| const{isBuiltin } = require('module'); | ||
| // Includes modules in lib/ (even deprecated ones) | ||
| assert(isBuiltin('http')); | ||
| assert(isBuiltin('sys')); | ||
| assert(isBuiltin('node:fs')); | ||
| assert(isBuiltin('node:test')); | ||
| // Does not include internal modules | ||
| assert(!isBuiltin('internal/errors')); | ||
| assert(!isBuiltin('test')); | ||
| assert(!isBuiltin('')); | ||
| assert(!isBuiltin(undefined)); |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.