# smushr

> a command line tool to aggregate discrete data points into a single readable result

Latest version **1.1.1** (published 2018-09-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install smushr
pnpm add smushr
yarn add smushr
bun add smushr
```

Provides the command `smush`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2018-09-25 |
| First published | 2018-09-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Phil Truong |
| Maintainers | pltruong |
| Keywords | smush, smushr, json, cli, command-line |

## Links

- npm: https://www.npmjs.com/package/smushr
- Repository: https://github.com/iRhuel/smush
- Homepage: https://github.com/iRhuel/smush#readme
- Issues: https://github.com/iRhuel/smush/issues
- npm.io page: https://npm.io/package/smushr

## Dependencies (1)

- [commander](https://npm.io/package/commander.md) ^2.18.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.1 (latest) — 2018-09-25
- 1.1.0 — 2018-09-24
- 1.0.0 — 2018-09-19

## README

# _smushr_

A command line tool to aggregate discrete data points across json files into a single readable result. It preserves 
structure of nested objects and arrays of indeterminant depth, allowing you to conveniently view all valid values for 
all keys at all levels. This would be useful for large sets of similar or repetitive .json files.

smushr searches target directories and optionally all subdirectories for .json files. It then creates a result object
with arrays under matching keys. It inserts all non-repeat data into its result key-array. It compares objects for key
parity and recurses on matching objects to preserve nested structure. Lastly, it writes the resultant object to a file
`smushed.json` (or optionally a file with custom name), in the directory where the command was executed.

## Getting Started

- install with `npm install -g smushr`

## Usage

- open a terminal
- in terminal, navigate to location with .json files to be combined
- run `smush [paths...]`, where `[paths...]` is a list of relative paths to the target folders from the current directory, separated by spaces.
- use the `-o` or `--output` flag to specify the output file name ( e.g. running `smush . -o test` will produce `./test.json` )
- include the `-r` or `--recursive` flag to also include subdirectories for parsing.

## Example

###### ./A.json
```$xslt
{
    "name": "Henry",
    "height": 167,
    "props": {
        "tasks": 
            [
                { "name": "doStuff" },
                { "id": 1 }
            ],
        "roles": "admin"
    }
}
```

###### ./B.json

```$xslt
{
    "name": "Max",
    "weight": 120,
    "props": {
        "tasks": 
            [
                { "name": "doDifferentStuff" },
                { "desc": "things need doing" }
            ],
        "roles": "user"
    }
}
```

###### ./smushed.json

```$xslt
{
    "name": ["Henry", "Max"],
    "height": [167],
    "weight": [120],
    "props": {
        "tasks": 
            [
                { "name": ["doStuff", "doDifferentStuff"] },
                { "id": [1] },
                { "desc": ["things need doing"] }
            ],
        "roles": ["admin", "user"]
    }
}
```

---
_Source: https://npm.io/package/smushr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
