Giter VIP home page Giter VIP logo

Comments (4)

kucherenko avatar kucherenko commented on June 3, 2024

for now you can use program interface, but it is little bit poor, will add this request to plans

from jscpd.

c089 avatar c089 commented on June 3, 2024

The second argument in the addFile method be the contents of the file, right? Then maybe rename it to something more generic to make it clear this is not reading a file, but expecting a string? If it should work on large codebases, maybe instead of strings also consider a stream interface that could then either have files or any other source. Otherwise 👍 on this.

from jscpd.

lo1tuma avatar lo1tuma commented on June 3, 2024

It would be also nice to be able to remove files, so you can compare the duplication results of two different versions of your code files.

Example:

var Detector = require('jscpd').Detector;

var detector = new Detector();

// add files of version 1
detector.addFile('foo.js', 'console.log("hello world")');
detector.addFile('bar.js', 'console.log("hello world")');
detector.addFile('baz.js', 'console.log("hello world")');

var resultOfVersion1 = detector.run();

// apply changes for version 2
detector.addFile('bar.js', 'console.log("changed file")');
detector.removeFile('baz.js');
// don’t add 'foo.js' because it didn’t change

var resultOfVersion2 = detector.run();

console.log('Your code duplication increased/decreased by:', compareResults(resultOfVersion1, resultOfVersion2), 'percent');

from jscpd.

kucherenko avatar kucherenko commented on June 3, 2024

https://github.com/kucherenko/jscpd/blob/master/docs/api.md

New version of jscpd released and powerful API there

from jscpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.