{
  "_id": "groupby-cli",
  "maintainers": [
    {
      "name": "stdbrouw",
      "email": "stijn@stdout.be"
    }
  ],
  "keywords": [
    "json",
    "transformation",
    "data",
    "etl"
  ],
  "dist-tags": {
    "latest": "0.2.1"
  },
  "author": {
    "name": "Stijn Debrouwere",
    "email": "stijn@debrouwere.org",
    "url": "http://debrouwere.org"
  },
  "_rev": "10-18e174006a5006cc3e26634a53042980",
  "description": "Split up JSON data into multiple files based on shared characteristics.",
  "readme": "# groupby\n\n[![Build Status](https://travis-ci.org/debrouwere/groupby.svg)](https://travis-ci.org/debrouwere/groupby)\n\nSplit up JSON data into multiple files based on shared characteristics. Groupby is a command-line utility but can also be used from [node.js](http://nodejs.org/).\n\n```shell\ngroupby staff.json 'staff/{department}.json'\n```\n\nIn the example above, the resulting output will one file for each department, \neach file containing an array of staff member objects for that department.\n\n## Installation\n\n```shell\nnpm install groupby-cli -g\n```\n\n## Usage\n\nGroupby expects an input JSON file that contains an array of similarly-structured\nobjects, and will group those objects when they have matching values for whatever \nkeys you specify as placeholders in the output pattern.\n\nFor example, `staff/{department}.json` will group objects together into \nthe same file if their `department` key matches.\n\nGrouping on multiple keys is supported too: \n\n```shell\ngroupby staff.json 'staff/{department}/{country}/{role}.json'\n```\n\nThe only requirement for groups is that values can be turned into a string \n(and thus into a filename to which we can write the resulting JSON.) Values\nwill be [slugified](https://github.com/dodo/node-slug) for use in filenames\nbut will be left as-is in the JSON.\n\nIn some cases, your output pattern uniquely identifies each \nindividual object, e.g. \n\n```shell\ngroupby staff.json 'staff/{username}.json'\n```\n\nTo save just the objects without wrapping each of them in an array, use the \n`--unique` flag. In `--unique` mode, Groupby will throw an error if your \noutput pattern does unexpectedly lead to groups that contain more than one item.\n\n## Use from node.js\n\n```javascript\n// basic usage\nvar groupby = require('groupby-cli');\nvar groups = groupby.group(list, facets);\n\n// usage that is more advanced, and more \n// similar to the command-line\nvar keyPattern = 'staff/{departments}';\nvar staffByDepartment = groupby.group(staff, keyPattern);\nvar sales = staffByDepartment['staff/sales'];\n```\n\n`groupby.group` takes an options object as a third argument: \n\n* **underscore** to underscore the slugified keys\n    * `false` by default\n    * when using the command-line interface, this is always set to `true`\n* **catch**\n    * `false` (default) to throw an error when encountering an uncategorizable object (this happens when not all objects contain a value for the specified facets)\n    * `true`: don't throw such errors and just get rid of any uncategorizable objects\n    * `\"destination\"`: create a group with all uncategorizable objects at the specified key\n\n## License\n\nGroupby comes with a permissive [ISC license](http://en.wikipedia.org/wiki/ISC_license).\n\nThe `countries.json` dataset included among the examples comes with an \n[Open Database License](http://opendatacommons.org/licenses/odbl/1.0/).\nFor the latest version, see @mledoze's [countries repository](https://github.com/mledoze/countries)\non GitHub.\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/debrouwere/groupby.git"
  },
  "bugs": {
    "url": "https://github.com/debrouwere/groupby/issues"
  },
  "license": "ISC",
  "versions": {
    "0.1.1": {
      "name": "groupby-cli",
      "version": "0.1.1",
      "description": "Split up JSON data into multiple files based on shared characteristics.",
      "main": "lib/index.js",
      "scripts": {
        "test": "make test"
      },
      "bin": {
        "groupby": "bin/groupby"
      },
      "repository": {
        "type": "git",
        "url": "https://github.com/stdbrouw/groupby.git"
      },
      "keywords": [
        "json",
        "transformation",
        "data",
        "etl"
      ],
      "author": {
        "name": "Stijn Debrouwere"
      },
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/stdbrouw/groupby/issues"
      },
      "homepage": "https://github.com/stdbrouw/groupby",
      "dependencies": {
        "commander": "2.1.x",
        "mkdirp": "^0.5.0",
        "simple-path-expressions": "^1.0.0-rc4",
        "slug": "^0.6.0",
        "underscore": "^1.7.0"
      },
      "devDependencies": {
        "coffee-script": "^1.8.0",
        "mocha": "^1.21.4",
        "should": "^4.0.4"
      },
      "gitHead": "1b3697854272e358339341e8a69dee30529329ef",
      "_id": "groupby-cli@0.1.1",
      "_shasum": "14c229e84e4794093257893146e132913e784288",
      "_from": ".",
      "_npmVersion": "1.4.23",
      "_npmUser": {
        "name": "stdbrouw",
        "email": "stijn@stdout.be"
      },
      "maintainers": [
        {
          "name": "stdbrouw",
          "email": "stijn@stdout.be"
        }
      ],
      "dist": {
        "shasum": "14c229e84e4794093257893146e132913e784288",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/groupby-cli/-/groupby-cli-0.1.1.tgz",
        "integrity": "sha512-18r9+oQgXE5QyP1aCqjpP1APsumj6RC6inL0ZvEx6TOkQ1JmK0VAIvvIEk8vZ8TmIR2XK5S00mDoJErwclJFeQ==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIHDdATNqdJZ+ZdscOvZZOAanhZbmbkdG8NgFrWg2KwYLAiAhYTa5OGKYw0uh889gksZ2wv8wF323gw9Y1C34SSFu3A=="
          }
        ]
      }
    },
    "0.1.2": {
      "name": "groupby-cli",
      "version": "0.1.2",
      "description": "Split up JSON data into multiple files based on shared characteristics.",
      "main": "lib/index.js",
      "scripts": {
        "test": "make test"
      },
      "bin": {
        "groupby": "bin/groupby"
      },
      "repository": {
        "type": "git",
        "url": "https://github.com/stdbrouw/groupby.git"
      },
      "keywords": [
        "json",
        "transformation",
        "data",
        "etl"
      ],
      "author": {
        "name": "Stijn Debrouwere"
      },
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/stdbrouw/groupby/issues"
      },
      "homepage": "https://github.com/stdbrouw/groupby",
      "dependencies": {
        "commander": "2.1.x",
        "mkdirp": "^0.5.0",
        "simple-path-expressions": "^1.0.0-rc4",
        "slug": "^0.6.0",
        "underscore": "^1.7.0"
      },
      "devDependencies": {
        "coffee-script": "^1.8.0",
        "mocha": "^1.21.4",
        "should": "^4.0.4"
      },
      "gitHead": "304702e28692db7f8603809b3ee9e6f03deba25c",
      "_id": "groupby-cli@0.1.2",
      "_shasum": "c9627f31e023e76c2a576bbf087110ad3e614886",
      "_from": ".",
      "_npmVersion": "1.4.23",
      "_npmUser": {
        "name": "stdbrouw",
        "email": "stijn@stdout.be"
      },
      "maintainers": [
        {
          "name": "stdbrouw",
          "email": "stijn@stdout.be"
        }
      ],
      "dist": {
        "shasum": "c9627f31e023e76c2a576bbf087110ad3e614886",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/groupby-cli/-/groupby-cli-0.1.2.tgz",
        "integrity": "sha512-QwjHtbSA/QOdlkv0j8FY4k4KEaaCESla8nyUOiNoVketc152hwu6RbxJPDGRpZFYF1zSzC19TgyoWof9Quomag==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQCogItJurwd6QjonmkXqmiKWR3S2aUldPBqRbUslMGWQAIhAP6O5Hfm/DTI6M6bL7Jbl6JcRwcHjyvFNS1k7uLIlve0"
          }
        ]
      }
    },
    "0.1.4": {
      "name": "groupby-cli",
      "version": "0.1.4",
      "description": "Split up JSON data into multiple files based on shared characteristics.",
      "main": "lib/index.js",
      "scripts": {
        "test": "make test"
      },
      "bin": {
        "groupby": "bin/groupby"
      },
      "repository": {
        "type": "git",
        "url": "https://github.com/debrouwere/groupby.git"
      },
      "keywords": [
        "json",
        "transformation",
        "data",
        "etl"
      ],
      "author": {
        "name": "Stijn Debrouwere",
        "email": "stijn@debrouwere.org",
        "url": "http://debrouwere.org"
      },
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/debrouwere/groupby/issues"
      },
      "homepage": "https://github.com/debrouwere/groupby",
      "dependencies": {
        "commander": "2.1.x",
        "mkdirp": "^0.5.0",
        "simple-path-expressions": "^1.0.0-rc4",
        "slug": "^0.6.0",
        "underscore": "^1.7.0"
      },
      "devDependencies": {
        "coffee-script": "^1.8.0",
        "mocha": "^1.21.4",
        "should": "^4.0.4"
      },
      "gitHead": "2d00f28dcad2424e07dbf69fa382219daa6aac7c",
      "_id": "groupby-cli@0.1.4",
      "_shasum": "e5e07e5428335cababeaeebba832d503c538b950",
      "_from": ".",
      "_npmVersion": "2.5.1",
      "_nodeVersion": "0.12.0",
      "_npmUser": {
        "name": "stdbrouw",
        "email": "stijn@debrouwere.org"
      },
      "maintainers": [
        {
          "name": "stdbrouw",
          "email": "stijn@stdout.be"
        }
      ],
      "dist": {
        "shasum": "e5e07e5428335cababeaeebba832d503c538b950",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/groupby-cli/-/groupby-cli-0.1.4.tgz",
        "integrity": "sha512-mpDyFJLkC3CoqbV7ue2L9+WjhEn9RTrdcyx2IwgY5UPndmDkwDw8fx/3p5E1ODPdfmvYTkMwzpKLbi0u9T1QqA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIBr3Dz+RbZC464sxTuM92dCbbyLv2/PPE7sxCMSF0EI5AiEA0eKCKuN/9dkMSpv53TQ9LVfJwKpgfxCv2+DZI2M7QoY="
          }
        ]
      }
    },
    "0.2.0": {
      "name": "groupby-cli",
      "version": "0.2.0",
      "description": "Split up JSON data into multiple files based on shared characteristics.",
      "main": "lib/index.js",
      "scripts": {
        "test": "make test"
      },
      "bin": {
        "groupby": "bin/groupby"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/debrouwere/groupby.git"
      },
      "keywords": [
        "json",
        "transformation",
        "data",
        "etl"
      ],
      "author": {
        "name": "Stijn Debrouwere",
        "email": "stijn@debrouwere.org",
        "url": "http://debrouwere.org"
      },
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/debrouwere/groupby/issues"
      },
      "homepage": "https://github.com/debrouwere/groupby",
      "dependencies": {
        "commander": "2.8.x",
        "mkdirp": "^0.5.0",
        "simple-path-expressions": "^1.1.2",
        "slug": "^0.6.0",
        "underscore": "^1.9.0"
      },
      "devDependencies": {
        "coffee-script": "^1.9.0",
        "mocha": "^1.21.4",
        "should": "^4.0.4"
      },
      "gitHead": "78d2fd36e4597443803c9ba1081560712c867685",
      "_id": "groupby-cli@0.2.0",
      "_shasum": "dc40420807e059ea5773266c86bc41ef8ecb55d5",
      "_from": ".",
      "_npmVersion": "2.11.2",
      "_nodeVersion": "0.12.5",
      "_npmUser": {
        "name": "stdbrouw",
        "email": "stijn@debrouwere.org"
      },
      "maintainers": [
        {
          "name": "stdbrouw",
          "email": "stijn@stdout.be"
        }
      ],
      "dist": {
        "shasum": "dc40420807e059ea5773266c86bc41ef8ecb55d5",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/groupby-cli/-/groupby-cli-0.2.0.tgz",
        "integrity": "sha512-awMREFbd4FKNSVb55XGy3QCqugdwVCKc84OkasBrszsS6z21XejRJVLSegdA3PD5wdkcJeww+a2SxknhBjpgFA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIErWvxpsU+g8obCw50w05Gf1haRCOjG7AeFaftEkKo0nAiBFi9AIvbGNY8bbw2TTzEi0bo3ha42WB9EEtuUQISUCgw=="
          }
        ]
      }
    },
    "0.2.1": {
      "name": "groupby-cli",
      "version": "0.2.1",
      "description": "Split up JSON data into multiple files based on shared characteristics.",
      "main": "lib/index.js",
      "scripts": {
        "test": "make test"
      },
      "bin": {
        "groupby": "bin/groupby"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/debrouwere/groupby.git"
      },
      "keywords": [
        "json",
        "transformation",
        "data",
        "etl"
      ],
      "author": {
        "name": "Stijn Debrouwere",
        "email": "stijn@debrouwere.org",
        "url": "http://debrouwere.org"
      },
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/debrouwere/groupby/issues"
      },
      "homepage": "https://github.com/debrouwere/groupby",
      "dependencies": {
        "commander": "2.8.x",
        "mkdirp": "^0.5.0",
        "simple-path-expressions": "^1.1.2",
        "slug": "^0.6.0",
        "underscore": "^1.8.0"
      },
      "devDependencies": {
        "coffee-script": "^1.9.0",
        "mocha": "^1.21.4",
        "should": "^4.0.4"
      },
      "gitHead": "10c0e5d084f4f6f298d4d1caf0ab70276e333b4f",
      "_id": "groupby-cli@0.2.1",
      "_shasum": "0a9307343e1e03b952f1f1cf05e4528681b08f2d",
      "_from": ".",
      "_npmVersion": "2.11.2",
      "_nodeVersion": "0.12.5",
      "_npmUser": {
        "name": "stdbrouw",
        "email": "stijn@debrouwere.org"
      },
      "maintainers": [
        {
          "name": "stdbrouw",
          "email": "stijn@stdout.be"
        }
      ],
      "dist": {
        "shasum": "0a9307343e1e03b952f1f1cf05e4528681b08f2d",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/groupby-cli/-/groupby-cli-0.2.1.tgz",
        "integrity": "sha512-50Dt9pvRJ3gczDW5tJ6tUMPCUkWe3HRfNWJipjEl/SPcTZNjPPerxwEB1bLu9bAidk2U4p4lcluNROWAUmkLcA==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQCrOPc9P/VBnYLSk+15CcSb9cdPn9tjPZMGNrHuYQN/OAIhAJ3gVTin+962mi7SruzCPLnUr3YKS//Cat9r+qei9t6n"
          }
        ]
      }
    }
  },
  "name": "groupby-cli",
  "time": {
    "modified": "2026-07-04T21:41:35.668Z",
    "created": "2014-09-20T22:09:16.869Z",
    "0.1.1": "2014-09-20T22:09:16.869Z",
    "0.1.2": "2014-09-24T13:39:00.921Z",
    "0.1.4": "2015-02-16T10:54:17.469Z",
    "0.2.0": "2015-06-27T08:45:25.861Z",
    "0.2.1": "2015-06-27T08:47:39.467Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/debrouwere/groupby"
}