Newton's Principia Mathematica
    Have ideas to improve npm?Join in the discussion! »

    @jscpd/core
    TypeScript icon, indicating that this package has built-in type declarations

    3.3.17 • Public • Published

    @jscpd/core

    core package for detect duplicates, depends only on eventemmiter3.

    Installation

    npm install @jscpd/core --save
    

    Usage

    import {Tokenizer} from '@jscpd/tokenizer';
    import {
        Detector,
        MemoryStore,
        IOptions,
        IClone,
        IStore,
        ITokenizer
    } from '@jscpd/core';
     
    const options: IOptions = {
        minLines: 5,
        maxLines: 500,
    }
     
    const tokenizer: ITokenizer = new Tokenizer();
     
    // here you can use any store what implement IStore interface
    const store: IStore = new MemoryStore();
     
    // list of validators, implemented IValidator interface, validate clones
    const validators = [];
     
    const detector = new Detector(tokenizer, store, validators, options);
     
    ( async () => {
        const format = 'javascript';
        const code: string = '...string with code...';
        const clones: IClone[] = await detector.detect('source_id', code, format);
     
        console.log(clones);
    })();
     

    ga tracker

    License

    MIT © Andrey Kucherenko

    Keywords

    none

    Install

    npm i @jscpd/core

    DownloadsWeekly Downloads

    30,248

    Version

    3.3.17

    License

    MIT

    Unpacked Size

    47.1 kB

    Total Files

    79

    Last publish

    Collaborators

    • avatar