Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use this to compare classes of the same interface? #93

Open
JJPell opened this issue Feb 19, 2020 · 0 comments
Open

Can I use this to compare classes of the same interface? #93

JJPell opened this issue Feb 19, 2020 · 0 comments

Comments

@JJPell
Copy link

JJPell commented Feb 19, 2020

Is there any way to use this library to compare classes which implement the same interface?

For example the following code doesn't appear to work.

const Hash = require('object-hash');

class Test {
  constructor(test, test2) {
    this.test = test;
    this.test2 = test2;
  }

  getTest = () => {
    return this.test;
  }

  getTest2 = () => {
    return this.test2;
  }
}

class Test2 {
  constructor(test, test2) {
    this.test = test;
    this.test2 = test2;
  }

  getTest = () => {
    return this.test;
  }

  getTest2 = () => {
    return this.test2;
  }
}

const options = {
  ignoreUnknown: true,
  respectFunctionProperties: false,
  respectFunctionNames: false,
  respectType: false,
};

console.log(Hash.MD5(new Test('123', 123), options));
console.log(Hash.MD5(new Test2('123', 123), options));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant