![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
babel-plugin-transform-es2015-typeof-symbol
Advanced tools
Package description
The babel-plugin-transform-es2015-typeof-symbol npm package is a plugin for Babel that ensures the behavior of the `typeof` operator is spec-compliant when used with symbols, a new primitive type introduced in ES2015 (ES6). It is part of the Babel's ES2015 preset and is used to transform code so that it can run in environments that do not natively support the new symbol type.
Transform typeof usage with symbols
This code sample demonstrates how the plugin transforms the `typeof` operator when used with a symbol. The plugin adds a helper function to correctly return 'symbol' when the operand is a symbol.
"use strict";
var _typeof = function (obj) {
return obj && obj.constructor === Symbol ? "symbol" : typeof obj;
};
var sym = Symbol('foo');
console.log(_typeof(sym) === 'symbol'); // true
This is the updated version of the babel-plugin-transform-es2015-typeof-symbol package, which is now scoped under the @babel namespace. It provides the same functionality but is maintained as part of the modern Babel 7 ecosystem.
This package is a Babel preset that includes babel-plugin-transform-es2015-typeof-symbol among other plugins to transform ES2015 code to be ES5 compliant. It is a more comprehensive solution that includes various transformations for ES2015 features.
Readme
ES6 introduces a new native type called symbols. This transformer wraps all
typeof
expressions with a method that replicates native behaviour. (ie. returning "symbol" for symbols)
In
typeof Symbol() === "symbol";
Out
var _typeof = function (obj) {
return obj && obj.constructor === Symbol ? "symbol" : typeof obj;
};
_typeof(Symbol()) === "symbol";
npm install --save-dev babel-plugin-transform-es2015-typeof-symbol
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-es2015-typeof-symbol"]
}
babel --plugins transform-es2015-typeof-symbol script.js
require("babel-core").transform("code", {
plugins: ["transform-es2015-typeof-symbol"]
});
FAQs
Unknown package
The npm package babel-plugin-transform-es2015-typeof-symbol receives a total of 1,023,958 weekly downloads. As such, babel-plugin-transform-es2015-typeof-symbol popularity was classified as popular.
We found that babel-plugin-transform-es2015-typeof-symbol demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.