Skip to main content

Utils

Helper functions that do not belong to any category in particular.

Functions

diff()

function diff(string1, string2): void

Helper function to print the differences between two strings. Similar to the diff Unix program.

Parameters

ParameterType
string1string
string2string

Returns

void

Defined in

packages/complete-node/src/functions/utils.ts:14


fatalError()

function fatalError(...args): never

Helper function to print out an error message and then exit the program.

All of the arguments will be passed to the console.error function.

Parameters

ParameterType
...argsreadonly unknown[]

Returns

never

Defined in

packages/complete-node/src/functions/utils.ts:30


getArgs()

function getArgs(): readonly string[]

Helper function to get the command-line arguments passed to the program/script.

This is an alias for: process.argv.slice(2)

Returns

readonly string[]

Defined in

packages/complete-node/src/functions/utils.ts:40


isMain()

function isMain(): boolean

Helper function to see if the current file is is the JavaScript/TypeScript entry point. Returns false if the current file was imported from somewhere else.

This is similar to the __name__ == "__main__" pattern from the Python programming language.

Returns

boolean

Defined in

packages/complete-node/src/functions/utils.ts:50