@minofrk/msf-io-ts
Version:
Type utilities with io-ts for MSF format.
42 lines • 1.51 kB
JavaScript
;
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spread = (this && this.__spread) || function () {
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
var codec_1 = require("./codec");
var has_duplicate_1 = require("./has-duplicate");
function isSpecCompliantState(state) {
if (!codec_1.State.is(state)) {
return false;
}
var alivePieces = __spread(state.ele[0], state.ele[1], state.ele[2], state.ele[3], state.ele[4], state.ele[5], state.ele[6]);
if (has_duplicate_1.hasDuplicate(__spread(state.arxe.txifol, state.sorn.txifol, [
state.arxe.evol,
state.sorn.evol
], alivePieces).filter(function (x) { return x !== null; }))) {
return false;
}
if (!state.korol.every(function (x) { return alivePieces.indexOf(x) !== -1; })) {
return false;
}
return true;
}
exports.isSpecCompliantState = isSpecCompliantState;
//# sourceMappingURL=compliant.js.map