babel-plugin-transform-flow-to-gen
Advanced tools
Comparing version
@@ -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", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
131607
0.09%1191
0.25%0
-100%