mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-19 22:26:18 +00:00
33 lines
630 B
JavaScript
33 lines
630 B
JavaScript
/*\
|
|
title: $:/core/modules/filters/getindex.js
|
|
type: application/javascript
|
|
module-type: filteroperator
|
|
|
|
returns the value at a given index of datatiddlers
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Export our filter function
|
|
*/
|
|
exports.getindex = function(source,operator,options) {
|
|
var data,title,results = [];
|
|
if(operator.operand){
|
|
source(function(tiddler,title) {
|
|
title = tiddler ? tiddler.fields.title : title;
|
|
data = options.wiki.extractTiddlerDataItem(tiddler,operator.operand);
|
|
if(data) {
|
|
results.push(data);
|
|
}
|
|
});
|
|
}
|
|
return results;
|
|
};
|
|
|
|
})();
|