Socket
Socket
Sign inDemoInstall

@thi.ng/equiv

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/equiv - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

<a name="0.1.3"></a>
## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/equiv@0.1.2...@thi.ng/equiv@0.1.3) (2018-05-14)
**Note:** Version bump only for package @thi.ng/equiv
<a name="0.1.2"></a>

@@ -8,0 +16,0 @@ ## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/equiv@0.1.1...@thi.ng/equiv@0.1.2) (2018-05-14)

2

package.json
{
"name": "@thi.ng/equiv",
"version": "0.1.2",
"version": "0.1.3",
"description": "Extensible deep equivalence checking for any data types",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -43,2 +43,35 @@ # @thi.ng/equiv

### Implement IEquiv interface
This is useful & required for custom types to take part in `equiv`
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
& `children` equality.
```ts
import { IEquiv } from "@thi.ng/api";
import { equiv } from "@thi.ng/equiv";
class Node implements IEquiv {
meta: any;
children: any[];
constructor(children: any[], meta?) {
this.children = children;
this.meta = meta;
}
equiv(o: any) {
return o instanceof Node && equiv(this.children, o.children);
}
}
equiv(new Node([1,2,3], "foo"), new Node([1,2,3], "bar"));
// true
```
## Authors

@@ -45,0 +78,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc