Skip to main content

callIfExists

Executes the given callback function, if present.

API

function callIfExists<GenericFunctionType>(callback: GenericFunctionType, ...args: any[]): void;

Usage

import { callIfExists } from '@feedzai/js-utilities';

// Calling a function with several arguments
callIfExists(functionName, arg1, arg2);

// Calling a function without any argument
callIfExists(functionName);