Socket
Socket
Sign inDemoInstall

@babel/helper-plugin-utils

Package Overview
Dependencies
0
Maintainers
6
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-beta.41 to 7.0.0-beta.42

20

lib/index.js

@@ -9,3 +9,3 @@ "use strict";

if (!api.assertVersion) {
api = Object.assign({}, api, {
api = Object.assign(copyApiObject(api), {
assertVersion: function assertVersion(range) {

@@ -21,2 +21,20 @@ throwVersionError(range, api.version);

function copyApiObject(api) {
var proto = null;
if (typeof api.version === "string" && /^7\./.test(api.version)) {
proto = Object.getPrototypeOf(api);
if (proto && (!has(proto, "version") || !has(proto, "transform") || !has(proto, "template") || !has(proto, "types"))) {
proto = null;
}
}
return Object.assign({}, proto, api);
}
function has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function throwVersionError(range, version) {

@@ -23,0 +41,0 @@ if (typeof range === "number") {

2

package.json
{
"name": "@babel/helper-plugin-utils",
"version": "7.0.0-beta.41",
"version": "7.0.0-beta.42",
"description": "General utilities for plugins to use",

@@ -5,0 +5,0 @@ "author": "Logan Smyth <loganfsmyth@gmail.com>",

@@ -6,3 +6,3 @@ export function declare(builder) {

// versions of Babel 7's beta that didn't have it.
api = Object.assign({}, api, {
api = Object.assign(copyApiObject(api), {
assertVersion(range) {

@@ -18,2 +18,29 @@ throwVersionError(range, api.version);

function copyApiObject(api) {
// Babel >= 7 <= beta.41 passed the API as a new object that had
// babel/core as the prototype. While slightly faster, it also
// means that the Object.assign copy below fails. Rather than
// keep complexity, the Babel 6 behavior has been reverted and this
// normalizes all that for Babel 7.
let proto = null;
if (typeof api.version === "string" && /^7\./.test(api.version)) {
proto = Object.getPrototypeOf(api);
if (
proto &&
(!has(proto, "version") ||
!has(proto, "transform") ||
!has(proto, "template") ||
!has(proto, "types"))
) {
proto = null;
}
}
return Object.assign({}, proto, api);
}
function has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function throwVersionError(range, version) {

@@ -20,0 +47,0 @@ if (typeof range === "number") {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc