Socket
Socket
Sign inDemoInstall

@babel/helper-annotate-as-pure

Package Overview
Dependencies
Maintainers
5
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-annotate-as-pure - npm Package Compare versions

Comparing version 7.0.0-beta.49 to 7.0.0-beta.50

4

package.json
{
"name": "@babel/helper-annotate-as-pure",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.50",
"description": "Helper function to annotate paths and nodes with #__PURE__ comment",

@@ -9,4 +9,4 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure",

"dependencies": {
"@babel/types": "7.0.0-beta.49"
"@babel/types": "7.0.0-beta.50"
}
}
# @babel/helper-annotate-as-pure
## API
> Helper function to annotate paths and nodes with #__PURE__ comment
```js
declare export default annotateAsPure(nodeOrPath: Node | NodePath);
```
See our website [@babel/helper-annotate-as-pure](https://new.babeljs.io/docs/en/next/babel-helper-annotate-as-pure.html) for more information.
## Usage
## Install
```js
import traverse from "@babel/traverse";
import annotateAsPure from "@babel/helper-annotate-as-pure";
Using npm:
// ...
traverse(file, {
CallExpression(path) {
annotateAsPure(path);
},
});
```sh
npm install --save @babel/helper-annotate-as-pure
```
## Caveat with UglifyJS pre v3.1.0
or using yarn:
`@babel/helper-annotate-as-pure` will append any existing leading comments to the `#__PURE__` annotation. Versions of UglifyJS prior to v3.1.0 will **ignore** these annotations, as they only check the _last_ leading comment for the annotation.
For example, using the `Usage` snippet above:
**In**
```js
const four = /* foo */ add(2, 2);
```sh
yarn add --save @babel/helper-annotate-as-pure
```
**Out**
```js
const four = /* #__PURE__ */ /* foo */ add(2, 2);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc