Socket
Socket
Sign inDemoInstall

xchanger

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xchanger - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.nyc_output/5d67ce04646a51c046494d1bf8974a1d.json

2

index.js

@@ -97,3 +97,3 @@ const fs = require('fs')

code = code.toString().toUpperCase()
return VALID_BASE_CODES.indexOf(code)
return VALID_BASE_CODES.indexOf(code) === -1 ? false : true
}

@@ -100,0 +100,0 @@

{
"name": "xchanger",
"version": "0.1.0",
"version": "0.1.1",
"description": "Currency exhange api with auto caching of api calls for better performance and bandwidth utilization",

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

@@ -17,5 +17,20 @@ ~~~~

# Usage
//TODO
Its really simple to use. Just require the module and create a new xchange
instance.
~~~~
const xchange = (require('xchanger'))()
xchange.setBase('inr') //Set the base exchange currency to use as a default
xchange.convert(100, 'usd').then(result => {
console.log(result)
}).catch(error => {
console.log(error)
})
~~~~
Thats it!
#Author
@author Hanut Singh Gusain <hanutsingh@gmail.com> [http://www.hanutsingh.in]
Created and maintained by Hanut Singh Gusain <hanutsingh@gmail.com> [http://www.hanutsingh.in]

@@ -112,2 +112,22 @@ const expect = require('chai').expect

})
context('provided base is invalid', function() {
it('should throw an error ', function(){
expect(() => xchange.setBase('abcd')).to.throw('invalid base code')
})
})
context('provided base is valid', function() {
let xchange = new XCHANGER('USD')
before(function(done) {
xchange.sync().then((rates) => {
xchange.rates = rates
done()
}).catch(done)
})
it('should set the modules base currency ', function(){
xchange.setBase('inr')
expect(xchange.base).is.eql('INR')
})
})
})

@@ -114,0 +134,0 @@

Sorry, the diff of this file is not supported yet

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