"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 _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
        _ref$ages = _ref.ages,
        ages = _ref$ages === void 0 ? [] : _ref$ages,
        key = _ref.type;
      const found = dataSource.find(_ref2 => {
        let type = _ref2.type;
        return parseInt(key) === type;
      });
      const _ref3 = found || {},
        fulfill = _ref3.fulfill;
      if (!found || fulfill && ages.filter(age => age === undefined).length) valid = false;
      return valid;
    });
    return valid;
  });
  return valid;
};
exports.checkRoom = checkRoom;
//# sourceMappingURL=checkRoom.js.map