🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@flex-development/is-builtin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flex-development/is-builtin

Universal drop-in replacement for module.isBuiltin

latest
Source
npmnpm
Version
3.2.0
Version published
Weekly downloads
524
-22.37%
Maintainers
1
Weekly downloads
 
Created
Source

is-builtin

github release npm codecov module type: esm license conventional commits typescript vitest yarn

Universal drop-in replacement for module.isBuiltin

Contents

What is this?

This package is a universal drop-in replacement for module.isBuiltin.

When should I use this?

This package exports a single function that can be used to determine if a module is a builtin module. Builtin modules are core modules maintained by Node.js. They can be imported by name or using a node: URL.

Install

This package is ESM only.

In Node.js (version 18+) with yarn:

yarn add @flex-development/is-builtin
See Git - Protocols | Yarn  for details regarding installing from Git.

In Deno with esm.sh:

import { isBuiltin } from 'https://esm.sh/@flex-development/is-builtin'

In browsers with esm.sh:

<script type="module">
  import { isBuiltin } from 'https://esm.sh/@flex-development/is-builtin'
</script>

Use

import { isBuiltin } from '@flex-development/is-builtin'

isBuiltin('@flex-development/is-builtin') // false
isBuiltin('assert')                       // true
isBuiltin('fs/promises')                  // true
isBuiltin(new URL('node:os'))             // true
isBuiltin('node:module')                  // true
isBuiltin('node:test/reporters')          // true
isBuiltin('test')                         // false
isBuiltin(null)                           // false

API

This package exports the identifier isBuiltin.

The default export is also isBuiltin.

isBuiltin(m)

Check if m references a builtin module.

👉 Note: m will be converted to a string (String(m)) before being checked.

Parameters

  • m (unknown) — the thing to check

Returns

true if m references builtin module, false otherwise.

Types

This package is fully typed with TypeScript.

Contribute

See CONTRIBUTING.md.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

Keywords

builtin

FAQs

Package last updated on 31 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts