🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
15 lines
317 B
JavaScript
Executable File
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);
|
|
};
|