Giter VIP home page Giter VIP logo

deep-diff's Introduction

dispix

My personal website, using node.js, gulp, jade and more.

deep-diff's People

Contributors

dispix avatar zeljic avatar

Stargazers

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

Watchers

 avatar  avatar

deep-diff's Issues

Non-object is blowing up function-call

So when I pass in nested objects that include various different children, I was getting an error First parameter must be an object.

After debugging I found that even though the key is undefined (not sure what type the key actually was) if continued in the if clause:

if (typeof obj2[key] === 'object')
https://github.com/dispix/deep-diff/blob/master/src/deepDiff.js#L40

I used lodash isPlainObject-function and this did notice it was not actually a function.

typeof is not very reliable check as everything (or a lot of things) in javascript are considered objects. So an improvement might be needed in that check.

This only happened with more complex objects and I ran into this problem after using deepDiff with more complexly nested Objects

I might be able to open a PR in a few days, not sure when I have time to spare next. For now I just copied the code and use it straight in my application instead of including it as a package

Issue with arrays of objects

Hi,

I believe there's an issue when trying to diff two objects that contain an array of object :

const obj1 = { prop1: [{ prop1: 'abc' }] };
const obj2 = { prop1: [{ prop1: 'abc' }] };
console.log(deepDiff(obj1, obj2));
// outputs {"prop1":[{"prop1":"abc"}]}

This is due to the fact arrayEquals only checks if the two props are arrays, but doesn't check if they are objects. It only runs this :

} else if (arr1[i] !== arr2[i]) {
    return false
}

I guess it should run the main deepDiff function instead, but no idea how that type of circular dependencies would be handled.

Cannot find module

I'm currently developing a node application and when I try to launch with your module installed it throws the following error

module.js:471
    throw err;
    ^

Error: Cannot find module './utils/arrayEquals'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\YorkAARGH\Desktop\Tutorial-Bot\node_modules\return-deep-diff\dist\main.js:9:20)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

I honestly have no idea how to fix this, but I thought you should know.

I'm running node v6.8.0 and npm 3.10.8 if that helps.

Test dist instead of sources in CI

Subject

Testing the dist output in Travis in order to ensure the webpack build is correctly done (this would prevent issues like #1 ).

Lead

Have a script like npm test:dist that sets NODE_ENV=production and require the dist in the test suite instead of the sources.

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.