1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-04 19:23:29 +00:00
TiddlyWiki5/core/modules/filterrunprefixes/intersection.js
2020-11-01 17:13:52 +00:00

30 lines
645 B
JavaScript

/*\
title: $:/core/modules/filterrunprefixes/intersection.js
type: application/javascript
module-type: filterrunprefix
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter prefix function
*/
exports.intersection = function(operationSubFunction) {
return function(results,source,widget) {
if(results.length !== 0) {
var secondRunResults = operationSubFunction(source,widget);
var firstRunResults = results.splice(0);
$tw.utils.each(firstRunResults,function(title) {
if(secondRunResults.indexOf(title) !== -1) {
results.push(title);
}
});
}
};
};
})();