4.0.3 • Published 6 months ago

@eklmv/jscpd-finder v4.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@eklmv/jscpd-finder

core package for detect duplicates, depends only on eventemitter3.

Installation

npm install @eklmv/jscpd-finder --save

Usage

import {Tokenizer} from '@eklmv/jscpd-tokenizer';
import {
    MemoryStore,
    IOptions,
    IClone,
    IStore,
    ITokenizer
} from '@eklmv/jscpd-core';
import {EntryWithContent, getFilesToDetect, InFilesDetector} from '@eklmv/jscpd-finder';

const options: IOptions = {
    minLines: 5,
    maxLines: 500,
    path: ['list of folders and files to analyse for clones']
}

const tokenizer: ITokenizer = new Tokenizer();
// here you can use any store what implement IStore interface
const store: IStore = new MemoryStore();
const statistic = new Statistic(options);

const files: EntryWithContent[] = getFilesToDetect(options);

const detector = new InFilesDetector(tokenizer, store, statistic, options);

( async () => {
  const clones: IClone[] = await detector.detect(files);
})();

ga tracker

License

MIT © Andrey Kucherenko