@rustable/utils
Version:
Essential utilities for object cloning, string manipulation, and value comparison in TypeScript, inspired by Rust's standard library.
23 lines (19 loc) • 398 B
JavaScript
;
var stringify = require('./stringify.js');
;
function equals(a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return false;
}
if (typeof a === "function") {
return a === b;
}
if (a?.constructor !== b?.constructor) {
return false;
}
return stringify.stringify(a) === stringify.stringify(b);
}
exports.equals = equals;