mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-19 22:26:18 +00:00
34 lines
611 B
JavaScript
34 lines
611 B
JavaScript
/*\
|
|
title: $:/core/modules/filters/enlist.js
|
|
type: application/javascript
|
|
module-type: filteroperator
|
|
|
|
Filter operator returning its operand parsed as a list
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Export our filter function
|
|
*/
|
|
exports.enlist = function(source,operator,options) {
|
|
var list = $tw.utils.parseStringArray(operator.operand);
|
|
if(operator.prefix === "!") {
|
|
var results = [];
|
|
source(function(tiddler,title) {
|
|
if(list.indexOf(title) === -1) {
|
|
results.push(title);
|
|
}
|
|
});
|
|
return results;
|
|
} else {
|
|
return list;
|
|
}
|
|
};
|
|
|
|
})();
|