@gamepark/rules-api
Version:
API to implement the rules of a board game
20 lines • 795 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSameLocationArea = void 0;
/**
* Utility function to know whether some locations share the same type, id, player and parent.
* @param locations Locations to test
* @returns true if all the locations belongs to the same "area" (only varies in coordinates or rotation)
*/
var isSameLocationArea = function () {
var locations = [];
for (var _i = 0; _i < arguments.length; _i++) {
locations[_i] = arguments[_i];
}
return locations.every(function (l, _, _a) {
var l0 = _a[0];
return l.type === l0.type && l.id === l0.id && l.player === l0.player && l.parent === l0.parent;
});
};
exports.isSameLocationArea = isSameLocationArea;
//# sourceMappingURL=Location.js.map