@thi.ng/equiv1.0.6 • Public • Published
This project is part of the @thi.ng/umbrella monorepo.
Extensible deep equivalence checking for any data types. Supports:
- JS primitives
- plain objects
- ES6 Sets / Maps
- types with
.equiv()implementations (IEquiv interface)
This feature was previously part of the @thi.ng/api package.
yarn add @thi.ng/equiv
;equiv, ;// true
Implement IEquiv interface
This is useful & required for custom types to take part in
checks, by default only plain objects & array are traversed deeply.
Furthemore by implementing this interface we can better control which
internal values / criteria are required to establish equivalence. In
this example we exclude the
meta property and only check for same type
;;equivnew Node, "foo", new Node, "bar";// true
- Karsten Schmidt
© 2018 Karsten Schmidt // Apache Software License 2.0