getMatches = (filter, tiddlers, widget) => {

  // use wiki as default source
  let source = undefined;

  // shortcuts for performance
  const wiki = $tw.wiki;

  if (typeof filter === 'string') {
    filter = wiki.compileFilter(filter);
  }

  // if a source is provided, create an iterator callback
  if (tiddlers != null && typeof tiddlers === 'object') {

    if (!Array.isArray(tiddlers)) {
      tiddlers = Object.keys(tiddlers);
    }

    source = callback => {
      for (let i = tiddlers.length; i--;) {
        const tObj = wiki.getTiddler(tiddlers[i]);
        callback(tObj, tiddlers[i]);
      }
    };

  }

  return filter.call(wiki, source, widget);

}
This function returns all tiddlers that match the filter.

@Todo: skip drafts! Or not?

@param {TiddlyWikiFilter} filter - The filter to use.
@param {TiddlerCollection} [tiddlers] - A set of tiddlers used as
    source. If not defined, all tiddlers and system tiddlers are
    selected. Shadows are *not* included.
@return {Array.<TiddlerReference>}