List fields (such as tags) when evaluated to produce tiddlers result in empty arrays.  Using the exact not equals, an empty array is not the same as an empty string.  By using equivelent not equals, we state that the field is either != "" or anything that can be coerced to "".  Which, based on https://dorey.github.io/JavaScript-Equality-Table/ is `false` `0` `[]` or `[[]]`` neither `false` nor `0` can be set as a tiddler field as both will end up being quoted (`"false"`, `"0"`) so this should work.
This commit is contained in:
Matt Lauber
2016-02-15 08:31:23 -05:00
parent e4fa7d579a
commit 22145e2e51
+1 -1
View File
@@ -25,7 +25,7 @@ exports.has = function(source,operator,options) {
});
} else {
source(function(tiddler,title) {
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] !== "") {
if(tiddler && $tw.utils.hop(tiddler.fields,operator.operand) && tiddler.fields[operator.operand] != "") {
results.push(title);
}
});