Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
404 B

const createFunction = (
{
conditionFn = () => true,
str = '',
condition = conditionFn() && str.length === 0,
}: {
condition?: boolean;
conditionFn?: (...args: unknown[]) => boolean;
str?: string;
},
fn: () => unknown,
...fnArgs: Parameters<typeof fn>
): (() => unknown) | undefined =>
condition ? fn.bind(null, ...fnArgs) : undefined;
export default createFunction;