1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-07 20:44:23 +00:00
TiddlyWiki5/core/modules/filters/is/draft.js
Cameron Fischer d0b5b2124a
Is draft (#6442)
* corrected [!is[draft]] to be a proper complement

* Ensuring [is[draft]] and [!is[draft]] are complements

* Made [is[draft]] more analogous to .isDraft()
2022-02-22 16:41:29 +00:00

37 lines
647 B
JavaScript

/*\
title: $:/core/modules/filters/is/draft.js
type: application/javascript
module-type: isfilteroperator
Filter function for [is[draft]] analagous to [has[draft.of]]
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.draft = function(source,prefix,options) {
var results = [];
if(prefix === "!") {
source(function(tiddler,title) {
if(!tiddler || !tiddler.isDraft()) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(tiddler && tiddler.isDraft()) {
results.push(title);
}
});
}
return results;
};
})();