From 395ef6ed85b1f12096cd14ff984ed6a20b13866b Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 15 Oct 2014 19:42:05 +1100 Subject: [PATCH] base58check: add deprecation warnings --- src/base58check.js | 18 ++++++++++++++++++ src/index.js | 2 +- test/base58check.js | 25 +++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/base58check.js create mode 100644 test/base58check.js diff --git a/src/base58check.js b/src/base58check.js new file mode 100644 index 0000000..2e91a43 --- /dev/null +++ b/src/base58check.js @@ -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 +} diff --git a/src/index.js b/src/index.js index 9be80f6..85f0631 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ module.exports = { Address: require('./address'), - base58check: require('bs58check'), + base58check: require('./bs58check'), bufferutils: require('./bufferutils'), crypto: require('./crypto'), ecdsa: require('./ecdsa'), diff --git a/test/base58check.js b/test/base58check.js new file mode 100644 index 0000000..09e9378 --- /dev/null +++ b/test/base58check.js @@ -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) + })) +})