Code Monkey home page Code Monkey logo

diffler's Introduction

diffler's People

Contributors

dependabot[bot] avatar omgaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

powhd

diffler's Issues

Eslint prettier

Automatically fix styling and readability issues in the code and align code base to common best practices.

Handling of arrays that are the same but ordered differently

Not really a bug I suppose but where you have two arrays in an object that are identical but in a different order diffler sees these as totally different arrays.

    const obj1 = {
        myArray: [
            { foo: 'bar' },
            { baz: 'bat' }
        ]
    }

    const obj2 = {
        myArray: [
            { baz: 'bat' },
            { foo: 'bar' }
        ]
    }

    const diff = diffler(obj1, obj2)

    console.log(JSON.stringify(diff))

gives

{"myArray":{"0":{"foo":{"from":"bar","to":null},"baz":{"from":null,"to":"bat"}},"1":{"baz":{"from":"bat","to":null},"foo":{"from":null,"to":"bar"}}}}

so would be nice to have an option to ignore ordering in arrays

but even if you accept that the order does matter I am not sure how 'human readable' this output is? But I am sure this is pretty complex stuff I wouldn't like to try ;-)

This library seems to fill a gap I am searching for this kind of tool to compare changes between json objects.

Refactor

Code hasn't been changed in ~5 years, could do with removing some complexity.

diffler function has a complexity of 19, it has many branches as well as recursion.

Depends upon #11

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.