Socket
Socket
Sign inDemoInstall

metautil

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metautil - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

8

CHANGELOG.md

@@ -5,2 +5,7 @@ # Changelog

## [3.4.0][] - 2021-02-21
- Implement simple polyfill for AbortController
- Support AbortController in `await timeout`
## [3.3.0][] - 2021-02-19

@@ -38,3 +43,4 @@

[unreleased]: https://github.com/metarhia/metautil/compare/v3.3.0...HEAD
[unreleased]: https://github.com/metarhia/metautil/compare/v3.4.0...HEAD
[3.4.0]: https://github.com/metarhia/metautil/compare/v3.3.0...v3.4.0
[3.3.0]: https://github.com/metarhia/metautil/compare/v3.2.0...v3.3.0

@@ -41,0 +47,0 @@ [3.2.0]: https://github.com/metarhia/metautil/compare/v3.1.0...v3.2.0

'use strict';
const path = require('path');
const { EventEmitter } = require('events');

@@ -144,5 +145,18 @@ const random = (min, max) => {

const timeout = (msec) =>
new Promise((resolve) => {
setTimeout(resolve, msec);
const createAbortController = () => {
const signal = new EventEmitter();
const abort = () => {
signal.emit('abort');
};
return { abort, signal };
};
const timeout = (msec, signal = null) =>
new Promise((resolve, reject) => {
const timer = setTimeout(resolve, msec);
if (!signal) return;
signal.on('abort', () => {
clearTimeout(timer);
reject();
});
});

@@ -165,3 +179,4 @@

parseCookies,
createAbortController,
timeout,
};

2

package.json
{
"name": "metautil",
"version": "3.3.0",
"version": "3.4.0",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

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