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

currency-converter-lt

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-converter-lt - npm Package Compare versions

Comparing version

to
1.2.0

24

index.js

@@ -27,4 +27,3 @@ const cheerio = require("cheerio")

"BAM": "Bosnia-Herzegovina Convertible Mark",
"BWP": "Botswanan Pula",
"BRL": "Brazilian Real",
"BWP": "Botswanan Pula", "BRL": "Brazilian Real",
"BND": "Brunei Dollar",

@@ -212,6 +211,14 @@ "BGN": "Bulgarian Lev",

if(this.currencyFrom === this.currencyTo)
return new Promise((resolve, _) => {resolve(1) })
return new Promise((resolve, _) => {resolve(this.currencyAmount) })
else
return got(`https://www.google.co.in/search?q=${this.currencyFrom}+to+${this.currencyTo}`)
.then((html) => {return cheerio.load(html.body)})
return got(`https://www.google.co.in/search?q=${this.currencyAmount}+${this.currencyFrom}+to+${this.currencyTo}`)
.then((html) => {
// const fs = require('fs');
// fs.writeFile("a.html", html.body, function(err) {
// if(err) {
// return console.log(err);
// }
// console.log("The file was saved!")})
return cheerio.load(html.body)})
.then(($) => {return $(".iBp4i").text().split(" ")[0]})

@@ -240,3 +247,8 @@ .then((rates) => {

return this.rates().then((rates) =>{
this.convertedValue = rates * this.currencyAmount
// this.convertedValue = rates * this.currencyAmount
// as the google result now sends the exact converted
// currency, multiplying the rates with currencyAmount
// makes it redundant.
this.convertedValue = rates * 1
return this.convertedValue

@@ -243,0 +255,0 @@ })

{
"name": "currency-converter-lt",
"version": "1.1.9",
"version": "1.2.0",
"description": "A nodejs currency converter library that doesn't require subscribing to any API calls.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,4 +9,4 @@ <div align="center">

__Announcement__ : For crypto currency conversion, check my other package [Nodejs Crypto Converter](https://github.com/paul-shuvo/nodejs-crypto-converter).
## Getting started

@@ -13,0 +13,0 @@

Sorry, the diff of this file is not supported yet