Giter Club home page Giter Club logo

cloned's Introduction

Object-Helper Documentation

isEqual

function isEqual(o1,o2,cfg,reverse)

o1 {Object} the object that is compared to
o2 {Object} the object that is compared with
cfg {Object} configuration settings:
exclude {Object} key/val map where the key is properties names we want to exclude from the comparison.
strictMode [Boolean] if true then === will be used to compare premitive types, otherwise == will be used.
noReverse {Boolean} if this is true then the method will avoid of the reverse comparison. this will improve the efficiency and speed of the function but could cause to unwanted results.
For example, o1={a:1}; o2={a:1,b:2}; then if we compare o2 to o1 it will match because o2 has property 'a' that has the value 1, but if we compare o1 to o2 it will fail. this is why we are doing a reverse compare. but the price for the reverse is in performance, since it is not implemented in the best way and it could reverse the same sub-objects more than once.
reverse - internal use of the recursion. do not use.
return {Boolean} true if the object are equal

###Examples var o1 = {a:1,b:2};
var o2 = {a:1,b:"2",c:3};
isEqual(o1,o2); //false - c is not in o1
isEqual(o1,o2,{noReverse:true}); //true
isEqual(o1,o2,{noReverse:true,strictMode:true}); //false - 2 doesn't match "2"
isEqual(o1,o2,{exclude:{"c":true}}); //true

for more information you can check the related blog post.

cloned's People

Contributors

mrharel avatar

Watchers

 avatar  avatar  avatar

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.