"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.checkRoom = void 0;
const checkRoom = function () {
  let rooms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  let dataSource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  if (!rooms.length || !dataSource.length) return false;
  let valid = true;
  rooms.every(function () {
    let room = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    room.filter(individual => !!individual).every(function () {
      let {
        ages = [],
        type: key
      } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      const found = dataSource.find(_ref => {
        let {
          type
        } = _ref;
        return parseInt(key) === type;
      });
      const {
        fulfill
      } = found || {};
      if (!found || fulfill && ages.filter(age => age === undefined).length) valid = false;
      return valid;
    });
    return valid;
  });
  return valid;
};
exports.checkRoom = checkRoom;
//# sourceMappingURL=checkRoom.js.map