{"size": 2677, "ext": "js", "max_stars_repo_path": "test_/EventJS-utilTack_test.js", "max_stars_repo_name": "OpenCrisp/Crsip.EventJS", "max_stars_repo_stars_event_min_datetime": "2015-07-09T22:36:25.000Z", "max_stars_repo_stars_event_max_datetime": "2015-07-09T22:36:25.000Z", "max_issues_repo_path": "test_/EventJS-utilTack_test.js", "max_issues_repo_name": "OpenCrisp/Crisp.EventJS", "max_issues_repo_issues_event_min_datetime": "2015-07-09T22:15:31.000Z", "max_issues_repo_issues_event_max_datetime": "2015-07-09T22:15:31.000Z", "max_forks_repo_path": "test_/EventJS-utilTack_test.js", "max_forks_repo_name": "OpenCrisp/Crisp.EventJS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 20.5923076923, "max_line_length": 65, "alphanum_fraction": 0.4927157266}

exports['utilPick.methodPicker'] = function(assert) {
    var done = assert.done || assert.async();
    assert.expect(4);

    var count = 0;
    var test = {};

    function fn( opt, success ) {
        success.call( this, 'a' );
    }
    
    test.fn = Crisp.utilPick( fn, true );

    test.fn(
        {},
        function success( doc ) {
            assert.strictEqual( doc, 'a' );
            assert.strictEqual( count++, 0 );
        },
        function complete() {
            assert.strictEqual( count++, 1 );
        }
    );

    assert.strictEqual( count++, 2 );

    done();
};

exports['utilPick.methodPicker picker'] = function(assert) {
    var done = assert.done || assert.async();
    assert.expect(5);

    var count = 0;
    var test = {};

    function fn( opt, success, picker ) {
        success.call( this, 'a', picker );
    }
    
    test.fn = Crisp.utilPick( fn, true );

    test.fn(
        {},
        function success( doc, picker ) {
            assert.strictEqual( doc, 'a' );
            assert.strictEqual( count++, 0 );

            picker.Wait();
            Crisp.nextTick(function() {
                assert.strictEqual( count++, 2 );
                picker.Talk();
            });
        },
        function complete() {
            assert.strictEqual( count++, 3 );
            done();
        }
    );

    assert.strictEqual( count++, 1 );
};

exports['utilPick.methodPicker opt.async'] = function(assert) {
    var done = assert.done || assert.async();
    assert.expect(4);

    var count = 0;
    var test = {};

    function fn( opt, success ) {
        success.call( this, 'a' );
    }
    
    test.fn = Crisp.utilPick( fn, true );

    test.fn(
        {
            async: true
        },
        function success( doc ) {
            assert.strictEqual( doc, 'a' );
            assert.strictEqual( count++, 1 );
        },
        function complete() {
            assert.strictEqual( count++, 2 );
            done();
        }
    );

    assert.strictEqual( count++, 0 );
};


exports['array.xEach.utilPick.methodPicker'] = function(assert) {
    var done = assert.done || assert.async();
    assert.expect(4);

    var count = 0;
    var test = ['a'];

    function itemEach() {
        Crisp.xEachArray.apply( this, arguments );
    }
    
    test.itemEach = Crisp.utilPick( itemEach, true );

    test.itemEach(
        {},
        function success( doc ) {
            assert.strictEqual( doc, 'a' );
            assert.strictEqual( ++count, 1 );
        },
        function complete() {
            assert.strictEqual( ++count, 2 );
        }
    );

    assert.strictEqual( ++count, 3 );
    done();
};







