1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 07:13:15 +00:00
TiddlyWiki5/core/modules/filters/minlength.js
2016-10-11 09:26:20 +01:00

30 lines
584 B
JavaScript

/*\
title: $:/core/modules/filters/minlength.js
type: application/javascript
module-type: filteroperator
Filter operator for filtering out titles that don't meet the minimum length in the operand
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.minlength = function(source,operator,options) {
var results = [],
minLength = parseInt(operator.operand || "",10) || 0;
source(function(tiddler,title) {
if(title.length >= minLength) {
results.push(title);
}
});
return results;
};
})();