Comparing version 0.1.2 to 1.0.0
@@ -30,4 +30,8 @@ #!/usr/bin/env node | ||
currency(argv[0], argv[1], argv[2], function(converted){ | ||
currency(argv[0], argv[1], argv[2], function(err, converted){ | ||
if (err) { | ||
throw err; | ||
} | ||
console.log(converted); | ||
}); | ||
}); |
{ | ||
"name": "currency", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"description": "simple currency conversion in the terminal", | ||
"main": "currency.js", | ||
"main": "index.js", | ||
"keywords": [ | ||
@@ -20,4 +20,4 @@ "currency", | ||
"dependencies": { | ||
"request": "~2.44.0", | ||
"money": "~0.2.0" | ||
"money": "0.2.0", | ||
"request": "2.60.0" | ||
}, | ||
@@ -29,3 +29,2 @@ "author": { | ||
}, | ||
"main": "currency.js", | ||
"bugs": { | ||
@@ -40,5 +39,5 @@ "url": "https://github.com/srn/currency.js/issues" | ||
"devDependencies": { | ||
"mocha": "~1.21.4", | ||
"nock": "~0.47.0" | ||
"mocha": "2.2.5", | ||
"nock": "2.9.1" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# currency.js [![Build Status](http://img.shields.io/travis/srn/currency.js.svg?style=flat-square)](https://travis-ci.org/srn/currency.js) [![Dependency Status](http://img.shields.io/gemnasium/srn/currency.js.svg?style=flat-square)](https://gemnasium.com/srn/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) | ||
@@ -8,21 +8,6 @@ > simple currency conversion in the terminal | ||
```sh | ||
$ npm install currency --save | ||
$ npm install currency --global | ||
``` | ||
## Usage | ||
```js | ||
var currency = require('currency'); | ||
currency(10, 'USD', 'DKK', function(converted){ | ||
console.log(converted); | ||
=> 57.54916 | ||
}); | ||
``` | ||
## CLI | ||
```sh | ||
$ npm install --global currency | ||
``` | ||
@@ -29,0 +14,0 @@ ```sh |
61
test.js
@@ -5,5 +5,6 @@ 'use strict'; | ||
var nock = require('nock'); | ||
var childProcess = require('child_process'); | ||
var currency = require('./'); | ||
var exchangeRates = { | ||
@@ -23,5 +24,5 @@ base: 'USD', | ||
describe('currency.js', function(){ | ||
it('USD to DKK', function(){ | ||
currency(10, 'USD', 'DKK', function(amount){ | ||
describe('conversion', function(){ | ||
it('should convert 10 USD to DKK', function(){ | ||
currency(10, 'USD', 'DKK', function(err, amount){ | ||
assert.equal(amount, 57.75516); | ||
@@ -31,4 +32,4 @@ }); | ||
it('DKK to USD', function(){ | ||
currency(100, 'DKK', 'USD', function(amount){ | ||
it('should convert 100 DKK to USD', function(){ | ||
currency(100, 'DKK', 'USD', function(err, amount){ | ||
assert.equal(amount, 17.314470256856705); | ||
@@ -38,7 +39,49 @@ }); | ||
it('MYR to DKK', function(){ | ||
currency(100, 'MYR', 'DKK', function(amount){ | ||
it('should convert 100 MYR to DKK', function(){ | ||
currency(100, 'MYR', 'DKK', function(err, amount){ | ||
assert.equal(amount, 178.78524192357588); | ||
}); | ||
}); | ||
}); | ||
it('should handle err', function(){ | ||
var body = { | ||
error: true, | ||
status: 401, | ||
message: 'invalid_app_id' | ||
}; | ||
nock.cleanAll(); | ||
nock('https://openexchangerates.org') | ||
.get('/api/latest.json?app_id=a1337') | ||
.reply(200, body); | ||
currency(100, 'MYR', 'DKK', function(err, amount){ | ||
assert.equal(err.message, body.message); | ||
assert.equal(amount, void 0); | ||
}); | ||
}); | ||
}); | ||
describe.skip('cli', function () { | ||
it('should execute', function (done) { | ||
childProcess.execFile('./cli.js', function (err, stdout) { | ||
assert.equal(err, null); | ||
assert.equal(stdout, 57.75516); | ||
done(); | ||
}); | ||
}); | ||
it('should execute with `app_id` env var', function (done) { | ||
process.env.APP_ID = 'a1337'; | ||
childProcess.execFile('./cli.js', function (err, stdout) { | ||
assert.equal(err, null); | ||
assert.equal(stdout, 57.75516); | ||
delete process.env.APP_ID; | ||
done(); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4881
8
124
0
27
3
1
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedbl@1.0.3(transitive)
+ Addedbluebird@2.11.0(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@1.0.1(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedhar-validator@1.8.0(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@0.11.0(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedprocess-nextick-args@1.0.7(transitive)
+ Addedqs@4.0.0(transitive)
+ Addedreadable-stream@2.0.6(transitive)
+ Addedrequest@2.60.0(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedasync@0.9.2(transitive)
- Removedbl@0.9.5(transitive)
- Removedboom@0.4.2(transitive)
- Removedcaseless@0.6.0(transitive)
- Removedcombined-stream@0.0.7(transitive)
- Removedcryptiles@0.2.2(transitive)
- Removeddelayed-stream@0.0.5(transitive)
- Removedforever-agent@0.5.2(transitive)
- Removedform-data@0.1.4(transitive)
- Removedhawk@1.1.1(transitive)
- Removedhoek@0.9.1(transitive)
- Removedhttp-signature@0.10.1(transitive)
- Removedisarray@0.0.1(transitive)
- Removedmime@1.2.11(transitive)
- Removedmime-types@1.0.2(transitive)
- Removedoauth-sign@0.4.0(transitive)
- Removedqs@1.2.2(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedrequest@2.44.0(transitive)
- Removedsntp@0.2.4(transitive)
Updatedmoney@0.2.0
Updatedrequest@2.60.0