Skip to content

noop

A no-operation function that does nothing and returns undefined

Useful as a default callback, placeholder, or to explicitly ignore a value.

Available since v2.0.0

import { noop } from '@helpers4/function';
noop(): void

void — Nothing (undefined)

Replace an optional callback with noop to avoid null checks.

const onComplete = options.callback ?? noop;
onComplete(); // does nothing

Pass noop wherever a function is required but no action is needed.

element.addEventListener('click', noop);

View source on GitHub