Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

currency

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

.editorconfig

8

cli.js

@@ -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

@@ -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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc