Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array.tsv() / object.tsv() #279

Closed
odino opened this issue Sep 4, 2019 · 1 comment
Closed

array.tsv() / object.tsv() #279

odino opened this issue Sep 4, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@odino
Copy link
Collaborator

odino commented Sep 4, 2019

Add the ability to convert an array / object to TSV. Useful to convert JSON to TSV.

@odino odino added the enhancement New feature or request label Sep 4, 2019
@odino odino added this to the 1.8.x milestone Sep 4, 2019
@odino
Copy link
Collaborator Author

odino commented Sep 4, 2019

Might as well do CSV at that point 😄

odino added a commit that referenced this issue Sep 10, 2019
Arrays can now easily be formatted as TSV / CSV content:

```
array.tsv()
array.tsv(",")
```

Here are some samples:

```
⧐  [["LeBron", "James"], ["James", "Harden"]].tsv()
LeBron	James
James	Harden

⧐  [{"name": "Lebron", "last": "James", "jersey": 23}, {"name": "James", "last": "Harden"}].tsv("\t", ["name", "last", "jersey", "additional_key"])
name	last	jersey	additional_key
Lebron	James	23	null
James	Harden	null	null
```

There is some complexity in this function due to the fact that
we have to support custom headers, as well as the fact that we
can both format arrays of objects as well as hashes.
odino added a commit that referenced this issue Sep 10, 2019
Arrays can now easily be formatted as TSV / CSV content:

```
array.tsv()
array.tsv(",")
```

Here are some samples:

```
⧐  [["LeBron", "James"], ["James", "Harden"]].tsv()
LeBron	James
James	Harden

⧐  [{"name": "Lebron", "last": "James", "jersey": 23}, {"name": "James", "last": "Harden"}].tsv("\t", ["name", "last", "jersey", "additional_key"])
name	last	jersey	additional_key
Lebron	James	23	null
James	Harden	null	null
```

There is some complexity in this function due to the fact that
we have to support custom headers, as well as the fact that we
can both format arrays of objects as well as hashes.
odino added a commit that referenced this issue Sep 10, 2019
Arrays can now easily be formatted as TSV / CSV content:

```
array.tsv()
array.tsv(",")
```

Here are some samples:

```
⧐  [["LeBron", "James"], ["James", "Harden"]].tsv()
LeBron	James
James	Harden

⧐  [{"name": "Lebron", "last": "James", "jersey": 23}, {"name": "James", "last": "Harden"}].tsv("\t", ["name", "last", "jersey", "additional_key"])
name	last	jersey	additional_key
Lebron	James	23	null
James	Harden	null	null
```

There is some complexity in this function due to the fact that
we have to support custom headers, as well as the fact that we
can both format arrays of objects as well as hashes.
odino added a commit that referenced this issue Sep 15, 2019
Arrays can now easily be formatted as TSV / CSV content:

```
array.tsv()
array.tsv(",")
```

Here are some samples:

```
⧐  [["LeBron", "James"], ["James", "Harden"]].tsv()
LeBron	James
James	Harden

⧐  [{"name": "Lebron", "last": "James", "jersey": 23}, {"name": "James", "last": "Harden"}].tsv("\t", ["name", "last", "jersey", "additional_key"])
name	last	jersey	additional_key
Lebron	James	23	null
James	Harden	null	null
```

There is some complexity in this function due to the fact that
we have to support custom headers, as well as the fact that we
can both format arrays of objects as well as hashes.
@odino odino self-assigned this Sep 15, 2019
odino added a commit that referenced this issue Sep 15, 2019
Arrays can now easily be formatted as TSV / CSV content:

```
array.tsv()
array.tsv(",")
```

Here are some samples:

```
⧐  [["LeBron", "James"], ["James", "Harden"]].tsv()
LeBron	James
James	Harden

⧐  [{"name": "Lebron", "last": "James", "jersey": 23}, {"name": "James", "last": "Harden"}].tsv("\t", ["name", "last", "jersey", "additional_key"])
name	last	jersey	additional_key
Lebron	James	23	null
James	Harden	null	null
```

There is some complexity in this function due to the fact that
we have to support custom headers, as well as the fact that we
can both format arrays of objects as well as hashes.
odino added a commit that referenced this issue Sep 15, 2019
Arrays can now easily be formatted as TSV / CSV content:

```
array.tsv()
array.tsv(",")
```

Here are some samples:

```
⧐  [["LeBron", "James"], ["James", "Harden"]].tsv()
LeBron	James
James	Harden

⧐  [{"name": "Lebron", "last": "James", "jersey": 23}, {"name": "James", "last": "Harden"}].tsv("\t", ["name", "last", "jersey", "additional_key"])
name	last	jersey	additional_key
Lebron	James	23	null
James	Harden	null	null
```

There is some complexity in this function due to the fact that
we have to support custom headers, as well as the fact that we
can both format arrays of objects as well as hashes.
@odino odino closed this as completed Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant