1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add Tiddler.getFieldStrings() method

This commit is contained in:
Jermolene 2017-04-17 17:04:15 +01:00
parent f03feb69a9
commit 2e0c119d5b

View File

@ -39,6 +39,24 @@ exports.getFieldString = function(field) {
}
};
/*
Get all the fields as a hashmap of strings. Options:
exclude: an array of field names to exclude
*/
exports.getFieldStrings = function(options) {
options = options || {};
var exclude = options.exclude || [];
var fields = {};
for(var field in this.fields) {
if($tw.utils.hop(this.fields,field)) {
if(exclude.indexOf(field) === -1) {
fields[field] = this.getFieldString(field);
}
}
}
return fields;
};
/*
Get all the fields as a name:value block. Options:
exclude: an array of field names to exclude