1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 02:33:15 +00:00
TiddlyWiki5/core/modules/filters/lookup.js
2017-09-07 15:48:00 +01:00

31 lines
672 B
JavaScript

/*\
title: $:/core/modules/filters/lookup.js
type: application/javascript
module-type: filteroperator
Filter operator that looks up values via a title prefix
[lookup:<field>[<prefix>]]
Prepends the prefix to the selected items and returns the specified field value
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.lookup = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
results.push(options.wiki.getTiddlerText(operator.operand + title) || options.wiki.getTiddlerText(operator.operand + operator.suffix));
});
return results;
};
})();