UNPKG

@minofrk/msf-io-ts

Version:

Type utilities with io-ts for MSF format.

39 lines 1.36 kB
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; }; import { State } from './codec'; import { hasDuplicate } from './has-duplicate'; export function isSpecCompliantState(state) { if (!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 (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; } //# sourceMappingURL=compliant.js.map