Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
babel-plugin-transform-es2015-typeof-symbol
Advanced tools
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.
$ npm install 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
This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)
The npm package babel-plugin-transform-es2015-typeof-symbol receives a total of 2,102,682 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.