base58check: add deprecation warnings

This commit is contained in:
Daniel Cousens 2014-10-15 19:42:05 +11:00
parent 307ceb9026
commit 395ef6ed85
3 changed files with 44 additions and 1 deletions

18
src/base58check.js Normal file
View file

@ -0,0 +1,18 @@
var bs58check = require('bs58check')
function decode() {
console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.');
bs58check.decode.apply(undefined, arguments)
}
function encode() {
console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.');
bs58check.encode.apply(undefined, arguments)
}
module.exports = {
decode: decode,
encode: encode
}

View file

@ -1,6 +1,6 @@
module.exports = {
Address: require('./address'),
base58check: require('bs58check'),
base58check: require('./bs58check'),
bufferutils: require('./bufferutils'),
crypto: require('./crypto'),
ecdsa: require('./ecdsa'),

25
test/base58check.js Normal file
View file

@ -0,0 +1,25 @@
var base58check = require('../src/base58check')
var bs58check = require('bs58check')
var sinon = require('sinon')
describe('base58check', function() {
var param
beforeEach(function() {
param = {}
})
it('wraps bs58check.decode', sinon.test(function() {
this.mock(bs58check).expects('decode')
.once().calledWith(param)
base58check.decode(param)
}))
it('wraps bs58check.encode', sinon.test(function() {
this.mock(bs58check).expects('encode')
.once().calledWith(param)
base58check.encode(param)
}))
})