Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@babel/plugin-transform-typeof-symbol
Advanced tools
This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)
The @babel/plugin-transform-typeof-symbol package is a plugin for Babel, a JavaScript compiler, that ensures the behavior of the 'typeof' operator is spec-compliant when used with symbols. In environments that do not fully support symbols, this plugin transforms 'typeof' checks to a method that can correctly identify 'symbol' types.
Transform typeof checks for symbols
This code represents the transformation that the plugin applies to 'typeof' checks. It defines a function that can correctly identify symbols, even in environments that do not natively support the 'symbol' type.
var _typeof = function(obj) { return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol ? 'symbol' : typeof obj; };
This package helps to reuse Babel's injected helper code to save on codesize. It includes a typeof helper for symbols, similar to what @babel/plugin-transform-typeof-symbol provides, but it's part of a broader set of transformations.
Although not a direct alternative, core-js is a modular standard library for JavaScript, which includes polyfills for symbols. It ensures that 'typeof' checks for symbols work correctly in older environments, similar to the goal of @babel/plugin-transform-typeof-symbol.
This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)
See our website @babel/plugin-transform-typeof-symbol for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-typeof-symbol
or using yarn:
yarn add @babel/plugin-transform-typeof-symbol --dev
v7.23.3 (2023-11-09)
babel-plugin-transform-typescript
babel-generator
concise: true
(@liuxingbaoyu)babel-compat-data
, babel-plugin-bugfix-v8-static-class-fields-redefine-readonly
, babel-preset-env
babel-plugin-transform-object-super
super.x
in a loop (@liuxingbaoyu)babel-helper-module-transforms
, babel-plugin-transform-modules-amd
, babel-plugin-transform-modules-commonjs
, babel-plugin-transform-modules-umd
__proto__
exports name in CJS/AMD/UMD (@magic-akari)babel-core
, babel-preset-env
preset-env
(@nicolo-ribaudo)babel-generator
@babel/generator
performance (@liuxingbaoyu)babel-traverse
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-typeof-symbol receives a total of 13,678,152 weekly downloads. As such, @babel/plugin-transform-typeof-symbol popularity was classified as popular.
We found that @babel/plugin-transform-typeof-symbol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.