Comparing version 0.0.5 to 0.1.0
@@ -1,40 +0,21 @@ | ||
var requirejs = require('requirejs').config({nodeRequire:require, baseUrl:''}); | ||
'use strict'; | ||
requirejs(['http', 'commander', 'money'], function (http, commander, money) { | ||
var options = { | ||
host: 'openexchangerates.org', | ||
path: '/api/latest.json?app_id=9c3a9fa4d4b7415e95880e677db3d080' | ||
}; | ||
var request = require('request'); | ||
var money = require('money'); | ||
var data = ''; | ||
http.request(options, function(response){ | ||
response.on('data', function (chunk) { | ||
data += chunk; | ||
}); | ||
module.exports = function(amount, from, to, callback){ | ||
var path = 'https://openexchangerates.org/api/latest.json?app_id=9c3a9fa4d4b7415e95880e677db3d080'; | ||
response.on('end', callback); | ||
}).end(); | ||
from = from ? from.toUpperCase() : 'USD'; | ||
to = to ? to.toUpperCase() : 'DKK'; | ||
var callback = function(){ | ||
data = JSON.parse(data); | ||
money.base = data.rates; | ||
request(path, function (error, response, body) { | ||
var data = JSON.parse(body); | ||
money.base = data.base; | ||
money.rates = data.rates; | ||
commander | ||
.version('0.0.4'); | ||
var converted = money.convert(amount, {from: from, to: to}); | ||
commander | ||
.command('* <currency> * [from] * [to]') | ||
.description('convert from any currency to any currency') | ||
.action(function(currency, from, to){ | ||
from = from ? from.toUpperCase() : 'USD'; | ||
to = to ? to.toUpperCase() : 'DKK'; | ||
var converted = money.convert(currency, {from: from, to: to}); | ||
console.log('=>', converted); | ||
}); | ||
commander.parse(process.argv); | ||
}; | ||
}); | ||
callback(converted); | ||
}); | ||
}; |
{ | ||
"name": "currency", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"description": "simple currency conversion in the terminal", | ||
"main": "currency.js", | ||
"keywords": [ | ||
@@ -12,9 +12,12 @@ "currency", | ||
], | ||
"license": "MIT", | ||
"bin": { | ||
"currency": "./bin/currency" | ||
"currency": "node currency.js" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"commander": "1.0.5", | ||
"money": "0.1.3", | ||
"requirejs": "2.1.1" | ||
"request": "~2.44.0", | ||
"money": "~0.2.0" | ||
}, | ||
@@ -27,10 +30,15 @@ "author": { | ||
"main": "currency.js", | ||
"readme": "readme.md", | ||
"engines": { | ||
"node": ">=0.6.20" | ||
"readme": "README.md", | ||
"bugs": { | ||
"url": "https://github.com/srn/currency.js/issues" | ||
}, | ||
"homepage": "https://github.com/srn/currency.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/soerenr/currency.js.git" | ||
"url": "https://github.com/srn/currency.js.git" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1.21.4", | ||
"nock": "~0.47.0" | ||
} | ||
} |
@@ -1,28 +0,40 @@ | ||
# currency.js | ||
# currency.js [![Build Status](http://img.shields.io/travis/srn/currency.js.svg?style=flat-square)](https://travis-ci.org/srn/currency.js) | ||
> simple currency conversion in the terminal | ||
Simple currency conversion in the terminal | ||
## Install | ||
## Installation | ||
```sh | ||
$ npm install currency --save | ||
``` | ||
```$ npm install currency -g``` | ||
## Usage | ||
## Usage | ||
```js | ||
var currency = require('currency'); | ||
currency(10, 'USD', 'DKK', function(converted){ | ||
console.log(converted); | ||
=> 57.54916 | ||
}); | ||
``` | ||
$ currency 10 USD DKK | ||
=> 57.54916 | ||
## CLI | ||
```sh | ||
$ npm install --global currency | ||
``` | ||
## LICENSE | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
```sh | ||
$ currency --help | ||
Copyright (C) 2012 Søren Brokær <root@srn.io> | ||
simple currency conversion in the terminal | ||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
Example | ||
currency 10 USD DKK | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
=> 57.75516 | ||
``` | ||
0. You just DO WHAT THE FUCK YOU WANT TO. | ||
## License | ||
MIT © [Søren Brokær](http://srn.io) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
3485
2
7
0
73
1
1
40
0
0
2
+ Addedrequest@~2.44.0
+ Addedasn1@0.1.11(transitive)
+ Addedassert-plus@0.1.5(transitive)
+ Addedasync@0.9.2(transitive)
+ Addedaws-sign2@0.5.0(transitive)
+ Addedbl@0.9.5(transitive)
+ Addedboom@0.4.2(transitive)
+ Addedcaseless@0.6.0(transitive)
+ Addedcombined-stream@0.0.7(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcryptiles@0.2.2(transitive)
+ Addedctype@0.5.3(transitive)
+ Addeddelayed-stream@0.0.5(transitive)
+ Addedforever-agent@0.5.2(transitive)
+ Addedform-data@0.1.4(transitive)
+ Addedhawk@1.1.1(transitive)
+ Addedhoek@0.9.1(transitive)
+ Addedhttp-signature@0.10.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedmime@1.2.11(transitive)
+ Addedmime-types@1.0.2(transitive)
+ Addedmoney@0.2.0(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.4.0(transitive)
+ Addedqs@1.2.2(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedrequest@2.44.0(transitive)
+ Addedsntp@0.2.4(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedtldts@6.1.63(transitive)
+ Addedtldts-core@6.1.63(transitive)
+ Addedtough-cookie@5.0.0(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
- Removedcommander@1.0.5
- Removedrequirejs@2.1.1
- Removedcommander@1.0.5(transitive)
- Removedkeypress@0.1.0(transitive)
- Removedmoney@0.1.3(transitive)
- Removedrequirejs@2.1.1(transitive)
Updatedmoney@~0.2.0