mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-09 02:08:05 +00:00
Add has:index (#4540)
* has:index * has:index * has:index docs * has op examples * has op examples * operator macros typo missing </div> * possible mistake
This commit is contained in:
@@ -3,7 +3,7 @@ title: $:/core/modules/filters/has.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for checking if a tiddler has the specified field
|
||||
Filter operator for checking if a tiddler has the specified field or index
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
@@ -33,7 +33,23 @@ exports.has = function(source,operator,options) {
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else if(operator.suffix === "index") {
|
||||
if(invert) {
|
||||
source(function(tiddler,title) {
|
||||
if(!tiddler || (tiddler && (!$tw.utils.hop($tw.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)))) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && $tw.utils.hop($tw.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(invert) {
|
||||
source(function(tiddler,title) {
|
||||
if(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand] === "")) {
|
||||
|
||||
Reference in New Issue
Block a user