API

Core Package

Use @jscpd/core for custom integrations.

Installation

npm install @jscpd/core

Overview

@jscpd/core contains the core detection algorithm. It can be used for detecting duplication in different environments with minimal dependencies.

Basic Usage

import { Detector, MemoryStore } from '@jscpd/core';

const store = new MemoryStore();
const detector = new Detector(store, options);

// Add your tokenized content
detector.detect(tokens);

Features

  • Minimal dependencies (only eventemitter3)
  • Can be used in browser environments
  • Customizable stores
  • Event-based detection process

Events

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);
});