mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-20 14:45:59 +00:00
![Jeremy Ruston](/assets/img/avatar_default.png)
Long overdue rewrite to make it simpler, and break the filter operators out into individual modules.
33 lines
613 B
JavaScript
33 lines
613 B
JavaScript
/*\
|
|
title: $:/core/modules/filters/sortcs.js
|
|
type: application/javascript
|
|
module-type: filteroperator
|
|
|
|
Filter operator for case-sensitive sorting
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Export our filter function
|
|
*/
|
|
exports.sortcs = function(source,operator,options) {
|
|
var results;
|
|
if($tw.utils.isArray(source)) {
|
|
results = source;
|
|
} else {
|
|
results = [];
|
|
$tw.utils.each(source,function(element,title) {
|
|
results.push(title);
|
|
});
|
|
}
|
|
options.wiki.sortTiddlers(results,operator.operand,operator.prefix === "!",true);
|
|
return results;
|
|
};
|
|
|
|
})();
|