New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-flow-comments

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-flow-comments - npm Package Compare versions

Comparing version 1.0.1 to 1.0.3

.travis.yml

14

lib/index.js

@@ -13,9 +13,11 @@ "use strict";

visitor: {
FlowDeclaration: function FlowDeclaration() {
this.addComment("leading", ":: " + this.getSource());
this.dangerouslyRemove();
Identifier: function Identifier(node, parent, scope, file) {
if (!node.optional || node.typeAnnotation) {
return;
}
this.addComment("trailing", ":: ?");
},
Flow: function Flow() {
var comment = this.getSource();
Flow: function Flow(node, parent, scope, file) {
var comment = this.getSource().replace("*/", "//");
if (parent.optional) comment = "?" + comment;
if (comment[0] !== ":") comment = ":: " + comment;

@@ -22,0 +24,0 @@ this.addComment("trailing", comment);

{
"name": "babel-plugin-flow-comments",
"version": "1.0.1",
"version": "1.0.3",
"description": "Turn flow type annotations into comments",

@@ -9,3 +9,4 @@ "repository": "babel-plugins/babel-plugin-flow-comments",

"devDependencies": {
"babel": "^5.6.0"
"babel": "^5.6.0",
"mocha": "^2.2.5"
},

@@ -15,3 +16,4 @@ "scripts": {

"push": "babel-plugin publish",
"test": "babel-plugin test"
"test": "babel-plugin test",
"test-mocha": "mocha --compilers js:babel/register"
},

@@ -18,0 +20,0 @@ "keywords": [

# babel-plugin-flow-comments
Turn flow type annotations into comments
Turn flow type annotations into comments.
http://flowtype.org/blog/2015/02/20/Flow-Comments.html
## Example
**In**
```javascript
function foo(bar?) {}
function foo2(bar?: string) {}
function foo(x: number): string {}
type B = {
name: string;
};
```
**Out**
```javascript
"use strict";
function foo(bar /*:: ?*/) {}
function foo2(bar /*:: ?: string*/) {}
function foo(x /*: number*/) /*: string*/ {}
/*:: type B = {
name: string;
};*/
```
## Installation

@@ -6,0 +34,0 @@

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