isGeneratorObjectLike

Test if a value is generator object-like.

Usage

var isGeneratorObjectLike = require( '@stdlib/assert/is-generator-object-like' );

isGeneratorObjectLike( value )

Tests if a value is generator object-like.

var obj = {
    'next': function noop() {},
    'return': function noop() {},
    'throw': function noop() {}
};
var bool = isGeneratorObjectLike( obj );
// returns true

bool = isGeneratorObjectLike( {} );
// returns false

Examples

var noop = require( '@stdlib/utils/noop' );
var isGeneratorObjectLike = require( '@stdlib/assert/is-generator-object-like' );

var obj = {
    'next': noop,
    'return': noop,
    'throw': noop
};
var bool = isGeneratorObjectLike( obj );
// returns true

bool = isGeneratorObjectLike( {} );
// returns false

bool = isGeneratorObjectLike( [] );
// returns false

bool = isGeneratorObjectLike( null );
// returns false
Did you find this page helpful?