node-extended

A set of helper functions for node

Usage no npm install needed!

<script type="module">
  import nodeExtended from 'https://cdn.skypack.dev/node-extended';
</script>

README

NodeExtended


NodeExtended makes difficult node functions easier.

For example, to request input from the user:

const response = await NodeExtended.input('What is your age?');

Contributions are always welcome, but please make an issue first.

Getting started

First, make sure you import the helper with

import NodeExtended from 'node-extended'

or, equally,

const { NodeExtended } = require('node-extended');

Then, you can use methods like so:

const response = await NodeExtended.input('What is your age?');

API

node-extendedGlobals"node-extended"

Module: "node-extended"

Index

Functions

Object literals

Functions

execute

execute(command: string, dir?: undefined | string): Promise‹string›

Defined in node-extended.ts:17

Execute a command

Parameters:

Name Type Description
command string
dir? undefined | string -

Returns: Promise‹string›


executeSync

executeSync(command: string, dir?: undefined | string): string

Defined in node-extended.ts:33

Execute a command syncronously

Parameters:

Name Type Description
command string
dir? undefined | string -

Returns: string


fetch

fetch(endpoint: string, bearerToken?: undefined | string): Promise‹Response›

Defined in node-extended.ts:73

Fetch anything. Uses node-fetch under the hood.

Parameters:

Name Type Description
endpoint string -
bearerToken? undefined | string

Returns: Promise‹Response›


input

input(input: string): Promise‹string›

Defined in node-extended.ts:43

Read input from the user

Parameters:

Name Type Description
input string

Returns: Promise‹string›


isAnswerYes

isAnswerYes(input: string): boolean | null

Defined in node-extended.ts:62

Whether the user accepted the input

Parameters:

Name Type Description
input string

Returns: boolean | null

Object literals

Const NodeExtended

NodeExtended: object

Defined in node-extended.ts:97


Const combined

combined: object

Defined in node-extended.ts:86

execute

execute: execute

Defined in node-extended.ts:87

executeSync

executeSync: executeSync

Defined in node-extended.ts:91

fetch

fetch: fetch

Defined in node-extended.ts:90

getRandomInt

getRandomInt: getRandomInt = Random.getRandomInt

Defined in node-extended.ts:92

input

input: input

Defined in node-extended.ts:89

isAnswerYes

isAnswerYes: isAnswerYes

Defined in node-extended.ts:88