/*
Currently implements the following rules:

- If 'items' is not specified, 'begin' and 'end' must be
338514
@Override
    public boolean isValid(TagData us) {
        if (!Util.isSpecified(us, ITEMS)) {
            if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END))) {
                return false;
            }
        }
        return true;
    }
987279
function (query, items) {
            var expression = query.query.where,
                ret = [];

            for (var i = 0; i < items.length; i++) {
                if (this._filterItem(items[i], expression)) {
                    ret.push(items[i]);
                }
            }

            return ret;

        }
1214564
function formatItems(items) {
    if (items.length <= 2) {
        return items.join(" and ")
    }
    return `all of ${items.slice(0, -1).join(", ")} and ${
        items[items.length - 1]
    }`
}
542964
function (type, item) {
        switch(type) {
            case simpleTypes.undefined:
            case simpleTypes.null:
                return true;
            case simpleTypes.string:
                if (item.trim().length === 0) {
                    return true;
                }
                return false;
            case simpleTypes.object:
                return (Object.keys(item).length === 0);
            case simpleTypes.array:
                return (item.length === 0);
            default:
                return false;
        };
    }
521747
function itemIsValid(item) {
    if (!('isValid' in item)) {
      return true;
    }
    if (_.isFunction(item.isValid)) {
      return item.isValid();
    }
    return false;
  }
1347205
function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) {
			if ( nextSiblingId ) {
				for ( var i = 0, item;
				( item = array[ i ] ); i++ ) {
					if ( item.id == nextSiblingId ) {
						array.splice( i, 0, newItem );
						return newItem;
					}

					if ( recurse && item[ recurse ] ) {
						var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true );
						if ( retval )
							return retval;
					}
				}

				if ( nullIfNotFound )
					return null;
			}

			array.push( newItem );
			return newItem;
		}
1049463
function (items) {
                var
                    idx;
                idx = items.length;
                while (idx--) {
                    if (0 !== items[idx].min()) {
                        ++idx;
                        break;
                    }
                }
                return idx;
            }
1347450
function applyDisallowedRuleToHash( itemsRule, items ) {
		if ( !itemsRule )
			return false;

		var hadInvalid = false,
			allDisallowed = itemsRule === true;

		for ( var name in items ) {
			if ( allDisallowed || itemsRule( name ) ) {
				delete items[ name ];
				hadInvalid = true;
			}
		}

		return hadInvalid;
	}
332219
function(items) {
			if (!this._define) {
				Object.defineProperty(this, "_define", {
					enumerable: false,
					value: {
						definitions: {
							length: { type: "number" },
							_length: { type: "number" }
						}
					}
				});
				Object.defineProperty(this, "_data", {
					enumerable: false,
					value: {}
				});
			}
			define.setup.call(this, {}, false);
			Object.defineProperty(this, "_length", {
				enumerable: false,
				configurable: true,
				writable: true,
				value: 0
			});
			if (items) {
				this.splice.apply(this, [ 0, 0 ].concat(canReflect.toArray(items)));
			}
		}
1249708
function(lastValue) {
      //var currentItem
      if (current === len) {
        cb && cb(lastValue);
        return;
      }
      var item = items[current++];
      setTimeout(function() {
        fn(item, function(val) {
          process(val && lastValue);
        });
      }, 20);
    }
1049888
function(item) {
            if(!item || !item.type || !item.element)
                return false;

            switch(item.type) {
                case 'milestone':
                    return (item.element.hasClass('timeline-milestone'));
                    break;
                case 'smallItem':
                    return (item.element.hasClass('timeline-smallitem'));
                    break;
                case 'bigItem':
                    return (item.element.hasClass('timeline-bigitem'));
                    break;
                default:
                    return false;
                    break;
            }
        }
569001
function(block) {
  if (block.last_line_blank) {
    return true;
  }
  if ((block.t == 'List' || block.t == 'ListItem') && block.children.length > 0) {
    return endsWithBlankLine(block.children[block.children.length - 1]);
  } else {
    return false;
  }
}
4756
function validateArrayTypeItemsExistence (api, response, schema, path) {
  if (schema.type === 'array' && _.isUndefined(schema.items)) {
    response.errors.push({
      code: 'OBJECT_MISSING_REQUIRED_PROPERTY',
      message: 'Missing required property: items',
      path: path
    });
  }
}
316836
private void matchItemIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart,
                              @NonNull ArrayMap<View, TransitionValues> unmatchedEnd,
                              @NonNull LongSparseArray<View> startItemIds,
                              @NonNull LongSparseArray<View> endItemIds) {
        int numStartIds = startItemIds.size();
        for (int i = 0; i < numStartIds; i++) {
            View startView = startItemIds.valueAt(i);
            if (startView != null && isValidTarget(startView)) {
                View endView = endItemIds.get(startItemIds.keyAt(i));
                if (endView != null && isValidTarget(endView)) {
                    TransitionValues startValues = unmatchedStart.get(startView);
                    TransitionValues endValues = unmatchedEnd.get(endView);
                    if (startValues != null && endValues != null) {
                        mStartValuesList.add(startValues);
                        mEndValuesList.add(endValues);
                        unmatchedStart.remove(startView);
                        unmatchedEnd.remove(endView);
                    }
                }
            }
        }
    }
664615
function convertItems(items)
                        {
                            if (!items || items.length <= 0)
                                return;

                            items.forEach(function (item) {
                                getPageIndex(item).then(
                                        function (pageIndex) {
                                            if (pageIndex != null)
                                                item.pageIndex = pageIndex;
                                            else
                                                delete item.pageIndex;
                                        },
                                        function (error) {
                                            log.error(
                                                    "cannot determine page index for outline item",
                                                    item, error);
                                            delete item.pageIndex;
                                        }
                                );
                                convertItems(item.items);
                            });
                        }
93973
function applyDisallowedRuleToArray( itemsRule, items ) {
		if ( !itemsRule )
			return false;

		var hadInvalid = false,
			allDisallowed = itemsRule === true;

		for ( var i = items.length; i--; ) {
			if ( allDisallowed || itemsRule( items[ i ] ) ) {
				items.splice( i, 1 );
				hadInvalid = true;
			}
		}

		return hadInvalid;
	}
459536
function validateStartEnd(start, end) {
  if (!start || !start.isValid) {
    return new Invalid("missing or invalid start");
  } else if (!end || !end.isValid) {
    return new Invalid("missing or invalid end");
  } else if (end < start) {
    return new Invalid(
      "end before start",
      `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`
    );
  } else {
    return null;
  }
}