1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 07:13:15 +00:00
TiddlyWiki5/core/modules/filters/untagged.js
Ben Webber 7a7472833f
Consider non-existent tiddlers untagged (#6478)
Fixes regression introduced in 575c23359.

Fixes: #6119
See-also: 575c23359 (Update untagged filter to avoid $tw.utils.pushTop (#6034), 2021-09-18)
2022-02-23 12:46:34 +00:00

30 lines
647 B
JavaScript

/*\
title: $:/core/modules/filters/untagged.js
type: application/javascript
module-type: filteroperator
Filter operator returning all the selected tiddlers that are untagged
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.untagged = function(source,operator,options) {
var results = [],
expected = (operator.prefix === "!");
source(function(tiddler,title) {
if(((tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) === expected) || (!tiddler && !expected)) {
results.push(title);
}
});
return results;
};
})();