vanillajs-helpers

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS

View the Project on GitHub Tokimon/vanillajs-helpers

vanillajs-helpers > “isGenerator”

External module: “isGenerator”

Index

Functions


Functions

isGenerator

isGenerator(obj: any): boolean

Defined in isGenerator.ts:39

Determine if the given object is a Generator Function

function* gen() {}

isGeneratorLike(gen); // -> true
isGeneratorLike(() => {}); // -> false

Parameters:

Param Type Description
obj any Object to test

Returns: boolean


isGeneratorLike

isGeneratorLike(obj: any): boolean

Defined in isGenerator.ts:20

Determine if the given object is a Generator(ish) object

function* gen() {}

isGeneratorLike(gen); // -> true
isGeneratorLike({ next() {}, throw() {} }); // -> true
isGeneratorLike(() => {}); // -> false

Parameters:

Param Type Description
obj any Object to test

Returns: boolean