1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-09 18:28:07 +00:00

Added zero based zth[] operator and documentation (#6150)

This commit is contained in:
Saq Imtiaz
2021-10-30 10:52:38 +02:00
committed by GitHub
parent d77de61a06
commit 4f65953da9
4 changed files with 49 additions and 7 deletions

View File

@@ -103,4 +103,16 @@ exports.nth = function(source,operator,options) {
return results.slice(count - 1,count);
};
/*
The zero based nth member of the list
*/
exports.zth = function(source,operator,options) {
var count = $tw.utils.getInt(operator.operand,0),
results = [];
source(function(tiddler,title) {
results.push(title);
});
return results.slice(count,count + 1);
};
})();