Socket
Book a DemoInstallSign in
Socket

babel-plugin-transform-flow-to-gen

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-flow-to-gen - npm Package Compare versions

Comparing version

to
0.0.5

6

lib/index.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.asGenerator = exports.types = exports.sampleOne = exports.sample = exports.default = undefined;
exports.$Gen = exports.asGenerator = exports.types = exports.sampleOne = exports.sample = exports.default = undefined;

@@ -38,5 +38,7 @@ var _plugin = require('./plugin');

/*:: import type {$Gen} from './types';*/
exports.sample = _sample2.default;
exports.sampleOne = _sampleOne2.default;
exports.types = types;
exports.asGenerator = _asGenerator2.default;
exports.asGenerator = _asGenerator2.default;
exports.$Gen = $Gen;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -13,3 +13,3 @@ Object.defineProperty(exports, "__esModule", {

var SPECIAL_GENERICS = ['Array', 'Object', '$Gen', '$Keys', '$Shape', '$Subtype'];
var SPECIAL_GENERICS = ["Array", "Object", "$Gen", "$Keys", "$Shape", "$Subtype"];

@@ -26,25 +26,25 @@ var isSpecialGeneric = function isSpecialGeneric(name) {

switch (name) {
case '$Gen':
return { type: 'generator', optional: optional, typeAlias: typeAST(params[0]), name: params[1].id.name };
case '$Keys':
case "$Gen":
return { type: "generator", optional: optional, typeAlias: typeAST(params[0]), name: params[1].id.name };
case "$Keys":
{
var typeAlias = typeAST(params[0]);
return { type: 'typeAliasKeys', optional: optional, typeAlias: typeAlias };
return { type: "typeAliasKeys", optional: optional, typeAlias: typeAlias };
}
case '$Shape':
case "$Shape":
{
var _typeAlias = typeAST(params[0]);
return { type: 'typeAliasShape', optional: optional, typeAlias: _typeAlias };
return { type: "typeAliasShape", optional: optional, typeAlias: _typeAlias };
}
case '$Subtype':
case "$Subtype":
{
return typeAST(params[0]);
}
case 'Array':
case "Array":
{
var elementType = typeAST(params[0]);
return { type: 'array', optional: optional, elementType: elementType };
return { type: "array", optional: optional, elementType: elementType };
}
case 'Object':
return { type: 'object', optional: optional, members: {} };
case "Object":
return { type: "object", optional: optional, members: {} };
}

@@ -56,7 +56,7 @@ };

var type = path.type.replace('TypeAnnotation', '').toLowerCase();
var type = path.type.replace("TypeAnnotation", "").toLowerCase();
var base = { type: type, optional: optional };
switch (type) {
case 'generic':
case "generic":
{

@@ -75,5 +75,5 @@ var typeParameters = path.typeParameters;

return { type: 'typeAlias', optional: optional, name: name, args: args };
return { type: "typeAlias", optional: optional, name: name, args: args };
}
case 'object':
case "object":
{

@@ -89,3 +89,3 @@ return path.properties.reduce(function (acc, prop) {

}
case 'array':
case "array":
{

@@ -95,12 +95,12 @@ var elementType = typeAST(path.elementType);

}
case 'booleanliteral':
case 'numberliteral':
case 'stringliteral':
case "booleanliteral":
case "numberliteral":
case "stringliteral":
{
var value = path.value;
return { type: 'literal', optional: optional, value: value };
return { type: "literal", optional: optional, value: value };
}
case 'intersection':
case 'tuple':
case 'union':
case "intersection":
case "tuple":
case "union":
{

@@ -112,3 +112,3 @@ var entries = path.types.map(function (p) {

}
case 'nullable':
case "nullable":
{

@@ -118,7 +118,7 @@ var _value = typeAST(path.typeAnnotation);

}
case 'void':
case 'function':
case 'string':
case 'number':
case 'boolean':
case "void":
case "function":
case "string":
case "number":
case "boolean":
default:

@@ -125,0 +125,0 @@ return _extends({}, base);

"use strict";
/*:: export type $Gen<T, Gen> = T*/
// eslint-disable-next-line no-unused-vars
/*:: export type $Gen<T, Gen> = T;*/
{
"name": "babel-plugin-transform-flow-to-gen",
"version": "0.0.4",
"version": "0.0.5",
"description": "Turn flow definitions into generator functions",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.