Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "assert/is-generator-object-like/docs/types/index.d"

Index

Functions

Export assignment isGeneratorObjectLike

  • isGeneratorObjectLike(value: any): boolean
  • Tests if a value is generator object-like.

    Parameters

    • value: any

      value to test

    Returns boolean

    boolean indicating whether value is generator object-like

    Example

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

    Example

    function* generateID() {
        var idx = 0;
        while ( idx < idx+1 ) {
            yield idx;
            idx += 1;
        }
    }
    var bool = isGeneratorObjectLike( generateID() );
    // returns true

    Example

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

    Example

    var bool = isGeneratorObjectLike( null );
    // returns false