Permalink
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (50 sloc) 1.13 KB

Filters

Filters are the second stage of the extension pipeline, called after validators and before mappers and forwarders. Their purpose is to purge unwanted parts of the data, so that only the required data is mapped and forwarded.

The choice of filter can be specified at the command line, using the -i option. One filter is available by default, unfiltered, which simply returns the data it receives unmodified.

Defining custom filters is easy. The basic pattern is to export an interface that looks like this:

{
    initialise: function (options) {
    }
}

Where initialise is a function that takes an options object and returns the filter function, bound to any pertinent options. The signature for the returned filter function should look like this:

function (/* bound options, ... */ data) {
}

Where data is the beacon data.

The filter function should return the filtered data object.