Compare objects by property type.
File size: 563 bytes.
Supported platforms: server and browser.
Supported language versions: ES5 and above.
If you use this library in your software please tweet me @benastontweet.
npm install looks-like
var looksLike = require('looks-like');
var o1, o2, example;
o1 = {
bar: {
bam: 'bam1',
bat: null
},
baz: 42
};
o2 = {
bar: {
bam: 'bam1',
bat: null
},
baz: '42'
};
example = {
foo: {
bar: {
bam: 'bam2'
},
baz: 1
}
};
looksLike(o1, example); // true
looksLike(o2, example); // false because o2.baz differs in type from example.baz.
This software is released under the MIT License. It is Copyright 2015, Ben Aston. I may be contacted at ben@bj.ma.
Pull requests including bug fixes, new features and improved test coverage are welcomed. Please do your best, where possible, to follow the style of code found in the existing codebase.