Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@babel/plugin-syntax-nullish-coalescing-operator
Advanced tools
Allow parsing of the nullish-coalescing operator
The @babel/plugin-syntax-nullish-coalescing-operator package allows Babel to parse code that uses the nullish coalescing operator (??). This 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. This package does not transform the nullish coalescing syntax; it only enables Babel to understand it.
Parsing nullish coalescing operator
This code demonstrates how the nullish coalescing operator is used to provide a default value ('default string') in case the left-hand operand (foo) is null or undefined.
const foo = null ?? 'default string';
This package not only allows Babel to parse the nullish coalescing operator but also transforms it. This means it can convert code using the nullish coalescing operator into equivalent code that does not use the operator, allowing it to run in environments that do not support the operator natively. It offers a superset of the functionality provided by @babel/plugin-syntax-nullish-coalescing-operator.
While not exclusively focused on the nullish coalescing operator, @babel/preset-env includes support for it among many other JavaScript features. This preset automatically determines the Babel plugins and polyfills needed based on the target environment's support for JavaScript features. It's a more comprehensive solution for writing modern JavaScript that is compatible with older environments.
Allow parsing of the nullish-coalescing operator.
npm install --save-dev @babel/plugin-syntax-nullish-coalescing-operator
.babelrc
(Recommended).babelrc
{
"plugins": ["@babel/plugin-syntax-nullish-coalescing-operator"]
}
babel --plugins @babel/plugin-syntax-nullish-coalescing-operator script.js
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-syntax-nullish-coalescing-operator"]
});
FAQs
Allow parsing of the nullish-coalescing operator
The npm package @babel/plugin-syntax-nullish-coalescing-operator receives a total of 15,599,802 weekly downloads. As such, @babel/plugin-syntax-nullish-coalescing-operator popularity was classified as popular.
We found that @babel/plugin-syntax-nullish-coalescing-operator 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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.