Skip to content

appendNodeOption

Appends a single node CLI option to a NODE_OPTIONS string, preserving any options already present.

Import:

import { appendNodeOption } from 'obsidian-dev-utils/script-utils/exec';

Signature:

function appendNodeOption(existingNodeOptions: string | undefined, option: string): string

Parameters:

ParameterTypeDescription
existingNodeOptionsstring | undefinedThe current NODE_OPTIONS value (e.g. process.env.NODE_OPTIONS), if any.
optionstringThe node CLI option to append (e.g. --localstorage-file=:memory:).

Returns: string — The combined NODE_OPTIONS string. If option is already present, the value is returned unchanged.