mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-22 23:16:53 +00:00
Add wiki.checkTiddlerText() convenience method
This commit is contained in:
parent
2397f0aa6f
commit
97e995e0c7
@ -1106,6 +1106,22 @@ exports.getTiddlerText = function(title,defaultText) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Check whether the text of a tiddler matches a given value. By default, the comparison is case insensitive, and any spaces at either end of the tiddler text is trimmed
|
||||
*/
|
||||
exports.checkTiddlerText = function(title,targetText,options) {
|
||||
options = options || {};
|
||||
var text = this.getTiddlerText(title,"");
|
||||
if(!options.noTrim) {
|
||||
text = text.trim();
|
||||
}
|
||||
if(!options.caseSensitive) {
|
||||
text = text.toLowerCase();
|
||||
targetText = targetText.toLowerCase();
|
||||
}
|
||||
return text === targetText;
|
||||
}
|
||||
|
||||
/*
|
||||
Read an array of browser File objects, invoking callback(tiddlerFieldsArray) once they're all read
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user