Socket
Socket
Sign inDemoInstall

metal

Package Overview
Dependencies
0
Maintainers
6
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.16.0 to 2.16.1

11

lib/async/async.js

@@ -11,2 +11,5 @@ /* !

});
var _metal = require('metal');
var async = {};

@@ -110,4 +113,8 @@

if (!async.nextTick.setImmediate_) {
// eslint-disable-next-line
async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_();
if (typeof setImmediate === 'function' && (0, _metal.isServerSide)({ checkEnv: false })) {
async.nextTick.setImmediate_ = setImmediate;
} else {
// eslint-disable-next-line
async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_();
}
}

@@ -114,0 +121,0 @@ async.nextTick.setImmediate_(cb);

@@ -322,6 +322,14 @@ 'use strict';

* `process` defined even though it runs on the browser.
* @param {?Object} options Contains `checkEnv` property which if true, checks
* the NODE_ENV variable. If NODE_ENV equals 'test', the function returns false.
* @return {boolean}
*/
function isServerSide() {
return typeof process !== 'undefined' && typeof process.env !== 'undefined' && process.env.NODE_ENV !== 'test' && !process.browser;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { checkEnv: true };
var serverSide = typeof process !== 'undefined' && !process.browser;
if (serverSide && options.checkEnv) {
serverSide = typeof process.env !== 'undefined' && process.env.NODE_ENV !== 'test';
}
return serverSide;
}

@@ -328,0 +336,0 @@

2

package.json
{
"name": "metal",
"version": "2.16.0",
"version": "2.16.1",
"description": "Core functions from Metal.js, with utilities for dealing with arrays, objects and others.",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

@@ -8,2 +8,4 @@ /* !

import {isServerSide} from 'metal';
const async = {};

@@ -107,4 +109,11 @@

if (!async.nextTick.setImmediate_) {
// eslint-disable-next-line
async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_();
if (
typeof setImmediate === 'function' &&
isServerSide({checkEnv: false})
) {
async.nextTick.setImmediate_ = setImmediate;
} else {
// eslint-disable-next-line
async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_();
}
}

@@ -111,0 +120,0 @@ async.nextTick.setImmediate_(cb);

@@ -298,11 +298,14 @@ 'use strict';

* `process` defined even though it runs on the browser.
* @param {?Object} options Contains `checkEnv` property which if true, checks
* the NODE_ENV variable. If NODE_ENV equals 'test', the function returns false.
* @return {boolean}
*/
export function isServerSide() {
return (
typeof process !== 'undefined' &&
typeof process.env !== 'undefined' &&
process.env.NODE_ENV !== 'test' &&
!process.browser
);
export function isServerSide(options = {checkEnv: true}) {
let serverSide = typeof process !== 'undefined' && !process.browser;
if (serverSide && options.checkEnv) {
serverSide =
typeof process.env !== 'undefined' &&
process.env.NODE_ENV !== 'test';
}
return serverSide;
}

@@ -309,0 +312,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc