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.0.5 to 0.1.0

.travis.yml

47

currency.js

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