Socket
Socket
Sign inDemoInstall

circular-migration-plot

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

31

bin/compile.js

@@ -9,2 +9,4 @@ #!/usr/bin/env node

// cat flows.csv | cmp-compile
// cmp-compile flows.csv --regions North,West
// cmp-compile flows.csv --regions North,West --pretty

@@ -16,11 +18,17 @@

var parser = require('binary-csv');
var parseArgs = require('minimist');
var parseOptions = { json: true };
var usage = 'Usage:\n cmp-compile flow.csv';
var usage = 'Usage: cmp-compile file [OPTIONS]\n\nAvailable Options:\n\n --regions, -r Sort order for regions\n --pretty, -p Pretty print result JSON';
var argv = parseArgs(process.argv.slice(2), {
alias: {
r: 'regions',
p: 'pretty'
},
boolean: 'pretty'
});
var pretty = argv.pretty;
var sortedRegions = argv.regions && argv.regions.split(/\s*,\s*/);
// Region sort order
var sortedRegions = ['North America', 'Africa', 'Europe', 'Fmr Soviet Union', 'West Asia', 'South Asia', 'East Asia', 'South-East Asia', 'Oceania', 'Latin America'];
// Input CSV has the form:

@@ -33,3 +41,3 @@ //

// Note that the header row is not included in the output!
var inputCsvFilename = process.argv[2];
var inputCsvFilename = argv._[0];
try {

@@ -141,6 +149,7 @@ var input = (!process.stdin.isTTY || inputCsvFilename === '-') ? process.stdin : fs.createReadStream(inputCsvFilename);

open(input).reduce(data, condense).map(label).each(function(json) {
// TODO: support -p --pretty flag:
// console.log(JSON.stringify(json, '', ' '));
console.log(JSON.stringify(json));
if (pretty) {
console.log(JSON.stringify(json, '', ' '));
} else {
console.log(JSON.stringify(json));
}
});
{
"name": "circular-migration-plot",
"version": "1.0.0",
"version": "1.1.0",
"description": "Creating interactive circular migration plots for the web using D3.",

@@ -20,3 +20,3 @@ "main": "index.js",

"type": "git",
"url": "git://github.com/null2/circular-migration-plot.git"
"url": "git://github.com/jo/circular-migration-plot.git"
},

@@ -31,5 +31,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/null2/circular-migration-plot/issues"
"url": "https://github.com/jo/circular-migration-plot/issues"
},
"homepage": "https://github.com/null2/circular-migration-plot",
"homepage": "https://github.com/jo/circular-migration-plot",
"devDependencies": {

@@ -46,4 +46,5 @@ "jshint": "^2.4.4",

"highland": "^1.16.1",
"underscore": "^1.6.0"
"underscore": "^1.6.0",
"minimist": "^0.2.0"
}
}
# Circular Migration Plot
Creating interactive circular migration plots for the web using D3.
Creating interactive circular migration plots for the web using D3,
like http://www.global-migration.info/

@@ -11,3 +12,3 @@ ## Installation

## Usage
### 1. Filtration
### 1. Filtration (optional)
You may want to filter countries with small migration flows:

@@ -19,5 +20,18 @@ ```shell

### 2. Compilation
Build the matrix json processible by the library out of the csv input file:
Build the matrix json processible by the library out of the csv input file.
#### Usage
`cmp-compile file [OPTIONS]`
#### Available Options
* `--regions`, `-r`: Sort order for regions
* `--pretty`, `-p`: Pretty print result JSON
#### Examples
```shell
cmp-compile data/flows.csv
cmp-compile flows.csv
cmp-compile -
cat flows.csv | cmp-compile
cmp-compile flows.csv --regions North,West
cmp-compile flows.csv --regions North,West --pretty
```

@@ -74,2 +88,2 @@

Copyright (c) 2014 null2 GmbH Berlin
Licensed under the MIT license.
This work as well as the sample data is licensed under a [Creative Commons Attribution-NonCommercial 3.0 Unported License](http://creativecommons.org/licenses/by-nc/3.0/).

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc