npm install @jscpd/core
@jscpd/core contains the core detection algorithm. It can be used for detecting duplication in different environments with minimal dependencies.
import { Detector, MemoryStore } from '@jscpd/core';
const store = new MemoryStore();
const detector = new Detector(store, options);
// Add your tokenized content
detector.detect(tokens);
eventemitter3)The detector emits events during detection:
detector.on('CLONE_FOUND', (clone) => {
console.log('Found clone:', clone);
});
detector.on('MATCH_START', (match) => {
console.log('Match started:', match);
});