
@gregoranders/csv (英语)
简单的 CSV 解析器 类型脚本



特征
- 类型脚本
- 欢乐 包含代码的单位测试
- GitHub CI 集成(地貌,开发,主机,发布)
- 通过 CI 发布
- 通过代码质量 气候
示例
npm install @gregoranders/csv
import Parser from '@gregoranders/csv';
const parser = new Parser();
const rows = parser.parse('a,b,c\n1,2,3\n4,5,6');
console.log(JSON.stringify(rows, null, 2));
[
[
"a",
"b",
"c"
],
[
"1",
"2",
"3"
],
[
"4",
"5",
"6"
]
]
console.log(JSON.stringify(parser.rows, null, 2));
[
[
"a",
"b",
"c"
],
[
"1",
"2",
"3"
],
[
"4",
"5",
"6"
]
]
console.log(JSON.stringify(parser.json, null, 2));
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "4",
"b": "5",
"c": "6"
}
]
克隆存储器
git clone https://github.com/gregoranders/ts-csv
安装依赖关系
npm install
构建
npm run build
测试
测试使用 欢乐
npm test
npm run codeclimate
清除
npm run clear