Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
evalcsv
Advanced tools
Readme
EvalCsv是一个可以把csv文件转换为json文件的命令行工具。
csv里面可以填一个对象:
p
{x:0,y:1}
还可以填一个数组:
arr
[{x:0,y:1}, {x:2,y:3}]
new一个对象也可以:
m
new Map()
支持javascript代码,语法简洁,错误提示全面, 因为这个程序仅仅是把csv里面的元素读取出来eval而已……
对于csv文件中的每一个元素value, 假定key为标题行对应列的值, evalcsv使用了一个很简单的办法来把csv文件转换为json对象:
eval("row." + key + " = " + value + ";");
有木有感觉到用csv表示对象, 数组等复杂数据原来是这么容易的事情?
用node.js的小伙伴们, 直接require这个json文件开始愉快的工作吧。
想要把csv资源打包的朋友们, 可以使用json2pb把json对象用protobuf打包。
npm install -g evalcsv
Usage: evalcsv [options] files
Options:
-h, --help Display this information.
-v, --version Print the compiler version.
-e, --encoding Set input file encoding, default encoding is 'gbk'.
-k, --key Set the line number of keys, default is 2.
-s, --start Set the starting line number for parsing, default is 3.
-f, --format Set the output format, default is {"rows":%s}
motion.csv
motion_id,name,privileges,type,category
motion_id,name,privileges,type,category
11001,"""跪姿肩部下沉""","['owner', 'admin', 'user', 'guest']","""热身""","""胸"""
11002,"""直体肩部下沉""","['owner', 'admin', 'user', 'guest']","""热身""","""胸"""
command line
evalcsv motion.csv
motion.json
{
"rows": [
{
"motion_id": 11001,
"name": "跪姿肩部下沉",
"privileges": [
"owner",
"admin",
"user",
"guest"
],
"type": "热身",
"category": "胸",
},
{
"motion_id": 11002,
"name": "直体肩部下沉",
"privileges": [
"owner",
"admin",
"user",
"guest"
],
"type": "热身",
"category": "胸",
}
]
}
FAQs
Eval Csv is a command line tool for converting csv files to json object.
The npm package evalcsv receives a total of 30 weekly downloads. As such, evalcsv popularity was classified as not popular.
We found that evalcsv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.