mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-28 20:12:41 +00:00
![Cameron Fischer](/assets/img/avatar_default.png)
* corrected [!is[draft]] to be a proper complement * Ensuring [is[draft]] and [!is[draft]] are complements * Made [is[draft]] more analogous to .isDraft()
37 lines
647 B
JavaScript
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;
|
|
};
|
|
|
|
})();
|