Files
rspade_system/node_modules/collect.js/src/methods/intersect.js
2025-12-03 21:28:08 +00:00

15 lines
317 B
JavaScript
Executable File

'use strict';
module.exports = function intersect(values) {
let intersectValues = values;
if (values instanceof this.constructor) {
intersectValues = values.all();
}
const collection = this.items
.filter(item => intersectValues.indexOf(item) !== -1);
return new this.constructor(collection);
};