Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/api

Package Overview
Dependencies
Maintainers
1
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/api - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

11

CHANGELOG.md

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

<a name="2.3.0"></a>
# [2.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.2.0...@thi.ng/api@2.3.0) (2018-04-26)
### Features
* **api:** support more types in equiv(), add tests ([2ac8bff](https://github.com/thi-ng/umbrella/commit/2ac8bff))
<a name="2.2.0"></a>

@@ -8,0 +19,0 @@ # [2.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.3...@thi.ng/api@2.2.0) (2018-04-08)

21

equiv.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const is_arraylike_1 = require("@thi.ng/checks/is-arraylike");
const is_date_1 = require("@thi.ng/checks/is-date");
const is_map_1 = require("@thi.ng/checks/is-map");
const is_plain_object_1 = require("@thi.ng/checks/is-plain-object");
const is_regexp_1 = require("@thi.ng/checks/is-regexp");
const is_set_1 = require("@thi.ng/checks/is-set");
function equiv(a, b) {

@@ -34,3 +38,13 @@ if (a === b) {

}
return false;
if ((is_set_1.isSet(a) && is_set_1.isSet(b)) || (is_map_1.isMap(a) && is_map_1.isMap(b))) {
return equivSetLike(a, b);
}
if (is_date_1.isDate(a) && is_date_1.isDate(b)) {
return a.getTime() === b.getTime();
}
if (is_regexp_1.isRegExp(a) && is_regexp_1.isRegExp(b)) {
return a.toString() === b.toString();
}
// NaN
return (a !== a && b !== b);
}

@@ -46,2 +60,7 @@ exports.equiv = equiv;

}
function equivSetLike(a, b) {
if (a.size !== b.size)
return false;
return equiv([...a].sort(), [...b].sort());
}
function equivObject(a, b) {

@@ -48,0 +67,0 @@ const keys = new Set(Object.keys(a).concat(Object.keys(b)));

4

package.json
{
"name": "@thi.ng/api",
"version": "2.2.0",
"version": "2.3.0",
"description": "Common, generic types & interfaces for thi.ng projects",

@@ -27,3 +27,3 @@ "main": "./index.js",

"dependencies": {
"@thi.ng/checks": "^1.4.0"
"@thi.ng/checks": "^1.5.0"
},

@@ -30,0 +30,0 @@ "keywords": [

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