UNPKG
@waynew/boa
Version:
latest (2.1.3)
2.1.3
2.1.2
2.1.1
2.1.0
Use Python modules seamlessly in Node.js
github.com/alibaba/pipcook
alibaba/pipcook
@waynew/boa
/
tools
/
check-network-env.js
19 lines
(15 loc)
•
293 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env node
'use strict'
;
function
safeParse
(
data
) {
try
{
return
JSON
.
parse
(data); }
catch
(e) {
return
{}; } } process.
stdin
.
on
(
'data'
,
(
msg
) =>
{
const
{ country } =
safeParse
(msg);
if
(country && country.
code
) { process.
stdout
.
write
(country.
code
); } });