Module FILLZ.FILTERS.v1

Module Summary

Using OR()

var amazon = FILLZ.SOURCE.AMAZONUS.v1;
var filter = FILLZ.FILTERS.v1;
var set_a = amazon.offers(filter.price.greater_than(10));
var set_b = amazon.offers(filter.condition.is_new());
var intersects = amazon.offers(filter.price.greater_than(10), filter.condition.is_new());
var union = amazon.offers(filter.OR(filter.price.greater_than(10), filter.condition.is_new()));
// result should be the same
assertEq(set_a.length() + set_b.length() - intersects.length(), union.length());

Using AND()

var amazon = FILLZ.SOURCE.AMAZONUS.v1;
var filter = FILLZ.FILTERS.v1;
var o1 = amazon.offers(filter.price.greater_than(10), filter.condition.is_new());
var o2 = amazon.offers(filter.AND(filter.price.greater_than(10), filter.condition.is_new()));
// result should be the same
assertEq(o1.length(), o2.length());

Using NOT()

var amazon = FILLZ.SOURCE.AMAZONUS.v1;
var filter = FILLZ.FILTERS.v1;
var o1 = amazon.offers(filter.price.greater_than(10));
var o2 = amazon.offers(filter.NOT(filter.price.greater_than(10)));
var o3 = amazon.offers();
// result should be the same
assertEq(o1.length() + o2.length(), o3.length());

Properties

Methods

  • OR(filters..)

    Filter to keep Offers that meet any of the filter criteria.

    Parameters

    • Two or more filter objects.

      Returns

    • A Filter object that will be true if any of the filters given in the arguments are true.

  • AND(filters..)

    Filter to keep Offers that meet all of the filter criteria.

    Parameters

    • Two or more filter objects.

      Returns

    • A Filter object that will be true if all of the filters given in the arguments are true. Note: The offers() and filter() methods are implicitly using AND() to combine their filter arguments.

  • NOT(filter)

    Filter to keep Offers that do not meet the filter criteria.

    Parameters

    • A filter object.

      Returns

    • A Filter object that will be true if the filter given is false, and vice-versa.