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

csvfmt

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csvfmt - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

DEVELOPMENT.md

5

args.js

@@ -14,3 +14,6 @@ const commandLineArgs = require('command-line-args')

console.error('csvfmt', require(require('path').join(__dirname, 'package.json')).version)
console.error('Usage at: https://github.com/pokle/csvfmt')
// console.error('Usage at: https://github.com/pokle/csvfmt')
const fs = require('fs')
const path = require('path')
console.error(String(fs.readFileSync(path.join(__dirname, 'README.md'))));
process.exit(0);

@@ -17,0 +20,0 @@ }

2

package.json
{
"name": "csvfmt",
"version": "1.0.4",
"version": "1.0.5",
"main": "index.js",

@@ -5,0 +5,0 @@ "bin": "./index.js",

@@ -8,6 +8,5 @@ # csvfmt

This is a command line tool, so install it globally so it's available on your path:
```shell
npm install --global csvfmt
```
npm install --global csvfmt
## Specifying files

@@ -17,9 +16,7 @@

```shell
$ csvfmt samples/people.csv
["name","sex","age"]
["morris","m","12"]
["jenna","f","13"]
["yarris","c","200"]
```
$ csvfmt samples/people.csv
["name","sex","age"]
["morris","m","12"]
["jenna","f","13"]
["yarris","c","200"]

@@ -32,45 +29,34 @@ csvfmt reads CSV files from its standard input stream if no files are specified.

```shell
$ csvfmt --headers samples/people.csv
{"name":"morris","sex":"m","age":"12"}
{"name":"jenna","sex":"f","age":"13"}
{"name":"yarris","sex":"c","age":"200"}
```
$ csvfmt --headers samples/people.csv
{"name":"morris","sex":"m","age":"12"}
{"name":"jenna","sex":"f","age":"13"}
{"name":"yarris","sex":"c","age":"200"}
...which makes it quite handy with jq:
```shell
$ csvfmt samples/people.csv --headers | jq 'select(.age | tonumber < 100)'
{
"name": "morris",
"sex": "m",
"age": "12"
}
{
"name": "jenna",
"sex": "f",
"age": "13"
}
```
$ csvfmt samples/people.csv --headers | jq 'select(.age | tonumber < 100)'
{
"name": "morris",
"sex": "m",
"age": "12"
}
{
"name": "jenna",
"sex": "f",
"age": "13"
}
--format lets you specify [sprintf](https://www.npmjs.com/package/sprintf-js) style formatting:
```shell
$ csvfmt samples/people.csv --headers --format '%(age)4d %(sex)s %(name)s'
12 m morris
13 f jenna
200 c yarris
```
$ csvfmt samples/people.csv --headers --format '%(age)4d %(sex)s %(name)s'
12 m morris
13 f jenna
200 c yarris
You can also use positional indexes:
```shell
csvfmt samples/people.csv --format '%2$s %1$s'
sex name
m morris
f jenna
c yarris
```
## Development
- `npm install -g` in this dir to install the dev version globally (symlinks!)
- Bump up the version and release with `npm publish`
$ csvfmt samples/people.csv --format '%2$s %1$s'
sex name
m morris
f jenna
c yarris
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