New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

usdbrl-cli

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

usdbrl-cli - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

2

bin/cli.js

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

.usage('Usage: $0 [options]')
.alias('s', 'sell')
.describe('sell', 'returns the exchange rate for the selling operation (default is buy)')
.describe('date', 'returns the exchange rate on a given <date> (dd/mm/yyyy)')

@@ -7,0 +9,0 @@ .alias('d', 'date')

13

lib/index.js

@@ -98,3 +98,4 @@ const https = require('https');

const line = match.match(/[^(.+?);]+/g)
const rate = line[4]
const buyRate = line[4]
const sellRate = line[5]
const date = line[0].split(/(\d{2})(\d{2})(\d{4})/)

@@ -106,3 +107,4 @@ .filter(Boolean)

date,
rate
buyRate,
sellRate
})

@@ -120,6 +122,7 @@ });

*/
const output = (exchangeRates, pretty = true) => {
const output = (exchangeRates, pretty = true, buy = true) => {
if (exchangeRates.length) {
if (pretty) {
const { date, rate } = exchangeRates.reverse()[0];
const { date, buyRate, sellRate } = exchangeRates.reverse()[0];
const rate = buy ? buyRate : sellRate;
console.log(`Exchange rate on ${date}: R$ ${rate}`)

@@ -156,3 +159,3 @@ } else {

const exchangeRates = processCSVData(data)
output(exchangeRates, prettyOutput)
output(exchangeRates, prettyOutput, !args.s)
});

@@ -159,0 +162,0 @@ }).on("error", (err) => {

{
"name": "usdbrl-cli",
"version": "0.1.2",
"version": "0.2.0",
"description": "A CLI to fetch BRL to USD exchange rates",

@@ -16,3 +16,3 @@ "main": "lib/index.js",

],
"author": "David Berri <dwbwill@gmail.com>",
"author": "David Berri <david@berribits.com>",
"license": "MIT",

@@ -19,0 +19,0 @@ "dependencies": {

@@ -71,3 +71,3 @@ # USD-BRL CLI

If you want to contact me you can reach me at <dwbwill@gmail.com>.
If you want to contact me you can reach me at <david@berribits.com>.

@@ -74,0 +74,0 @@ ## License

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