mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-19 10:49:43 +00:00
30 lines
584 B
JavaScript
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;
|
||
|
};
|
||
|
|
||
|
})();
|