{"size": 904, "ext": "js", "max_stars_repo_path": "test/findposition.js", "max_stars_repo_name": "ajlopez/SimpleBoard", "max_stars_repo_stars_event_min_datetime": "2020-11-13T07:28:04.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-13T07:28:04.000Z", "max_issues_repo_path": "test/findposition.js", "max_issues_repo_name": "ajlopez/SimpleBoard", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/findposition.js", "max_forks_repo_name": "ajlopez/SimpleBoard", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.1111111111, "max_line_length": 93, "alphanum_fraction": 0.6227876106}

const simpleboard = require('../');
const assert = require('assert');
    
// Find position in empty board

{
    const board = simpleboard.createBoard();
    const position = board.findPosition(function(content) { return content.color === 1; });

    assert.equal(position, null);
}

// Find position by color
{
    const board = simpleboard.createBoard();
    const content1 = { color: 1 };
    const content2 = { color: 2 };

    board.put(0, 0, content1);
    board.put(1, 1, content2);

    const position = board.findPosition(function(content) { return content.color === 1; });

    assert.ok(position);
    assert.equal(position.x, 0);
    assert.equal(position.y, 0);

    const position2 = board.findPosition(function(content) { return content.color === 2; });

    assert.ok(position2);
    assert.equal(position2.x, 1);
    assert.equal(position2.y, 1);
}

