Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-flow-type-getter

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-flow-type-getter - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

9

example/index.js

@@ -38,4 +38,7 @@ class Test1 {

typeof obj_test.t1.prop8 == 'User'); // false
typeof Test1.prop2 == 'User'); // true
Array.isArray(Test1.prop5)); // false
const test1_str = 't1';
console.log('unary test : ', typeof obj_test[test1_str].prop1); // number
console.log('binary test : ', typeof obj_test.t1.prop2 == 'User'); // true
console.log('array test : ', Array.isArray(Test1.prop5)); // false
console.log('array test : ', Array.isArray(obj_test['t2'].prop2)) // true

@@ -153,7 +153,14 @@ const babylon = require('babylon');

if(t.isMemberExpression(node)) {
return `${objectStringGenerator(node.object)}.${node.property.name}`;
if(node.computed) {
if(t.isStringLiteral(node.property)) {
return `${objectStringGenerator(node.object)}['${node.property.value}']`;
}
else {
return `${objectStringGenerator(node.object)}[${node.property.name}]`;
}
}
else {
return `${objectStringGenerator(node.object)}.${node.property.name}`;
}
}
else if(t.isStringLiteral(node, { computed : true })) {
return `${objectStringGenerator(node.object)}.['${node.property.name}']`;
}
else if(t.isIdentifier(node)) {

@@ -160,0 +167,0 @@ return node.name;

{
"name": "babel-plugin-flow-type-getter",
"version": "1.0.3",
"version": "1.0.4",
"description": "Access flow types from uninstantiated classes.",

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

@@ -58,6 +58,8 @@ ## Access your Flow types from classes before you instantiate objects.

typeof obj_test.t1.prop8 == 'User'); // false
typeof Test1.prop2 == 'User'); // true
Array.isArray(Test1.prop5)); // false
const test1_str = 't1';
console.log('unary test : ', typeof obj_test[test1_str].prop1); // number
console.log('binary test : ', typeof obj_test.t1.prop2 == 'User'); // true
console.log('array test : ', Array.isArray(Test1.prop5)); // false
console.log('array test : ', Array.isArray(obj_test['t2'].prop2)) // true
````

@@ -64,0 +66,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