Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@babel/plugin-transform-nullish-coalescing-operator
Advanced tools
Remove nullish coalescing operator
The @babel/plugin-transform-nullish-coalescing-operator package allows Babel to transform nullish coalescing operator (??) syntax into equivalent JavaScript code that can run in environments that do not support this operator. The nullish coalescing operator is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.
Transform nullish coalescing operator
This feature transforms the nullish coalescing operator (??) into equivalent JavaScript code. In this example, if 'foo' is null or undefined, 'bar' will be set to 'default value'. Otherwise, 'bar' will be set to the value of 'foo'.
const foo = null;\nconst bar = foo ?? 'default value';
This package allows Babel to transform optional chaining (?.) syntax, which is somewhat related to the nullish coalescing operator in that it helps with dealing with null or undefined values. However, optional chaining is used to access properties of an object without having to explicitly check if each reference in the chain is null or undefined.
While not a direct equivalent, @babel/preset-env includes support for transforming nullish coalescing operators among many other JavaScript features based on the target environment. It's a broader solution for compiling modern JavaScript down to a version compatible with older browsers or environments.
Remove nullish coalescing operator
See our website @babel/plugin-transform-nullish-coalescing-operator for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-nullish-coalescing-operator
or using yarn:
yarn add @babel/plugin-transform-nullish-coalescing-operator --dev
FAQs
Remove nullish coalescing operator
The npm package @babel/plugin-transform-nullish-coalescing-operator receives a total of 12,719,552 weekly downloads. As such, @babel/plugin-transform-nullish-coalescing-operator popularity was classified as popular.
We found that @babel/plugin-transform-nullish-coalescing-operator 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.