flow-infer-type
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -6,6 +6,19 @@ #!/usr/bin/env node | ||
const parse = str => { | ||
let result; | ||
try { | ||
// good json | ||
result = JSON.parse(str.toString()); | ||
} catch (e) { | ||
// plain js object | ||
eval(`result = ${str}`); | ||
} | ||
return result; | ||
}; | ||
process.stdin.resume(); | ||
process.stdin.on('data', data => { | ||
const obj = JSON.parse(data.toString()); | ||
console.log(createFlowType(obj)); | ||
console.log(createFlowType(parse(data))); | ||
}); |
{ | ||
"name": "flow-infer-type", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Generate flow type description from given object", | ||
@@ -5,0 +5,0 @@ "main": "./dist/bin.js", |
@@ -5,4 +5,12 @@ # About | ||
# Install | ||
``` | ||
npm i -g flow-infer-type | ||
``` | ||
# Usage | ||
`echo '{"a": "ssss"}' | node src/bin.js` | ||
## json | ||
```bash | ||
echo \'{"a": "ssss"}\' | node flow-infer-type | ||
``` | ||
{ | ||
@@ -14,3 +22,3 @@ a: string | ||
## clipboard | ||
```bash | ||
@@ -21,3 +29,8 @@ pbpaste | node flow-infer-type | ||
## js object | ||
```bash | ||
echo \'{a: "ssss"}\' | node flow-infer-type | ||
``` | ||
# Test | ||
@@ -24,0 +37,0 @@ ```bash |
@@ -5,6 +5,19 @@ #!/usr/bin/env node | ||
const parse = (str) => { | ||
let result | ||
try { | ||
// good json | ||
result = JSON.parse(str.toString()) | ||
} catch (e) { | ||
// plain js object | ||
eval(`result = ${str}`) | ||
} | ||
return result | ||
} | ||
process.stdin.resume() | ||
process.stdin.on('data', data => { | ||
const obj = JSON.parse(data.toString()) | ||
console.log(createFlowType(obj)) | ||
console.log(createFlowType(parse(data))) | ||
}) |
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
49365
17
191
38
2