From f366e4b0cc71728a74ded25c0f2efe48c05daa37 Mon Sep 17 00:00:00 2001 From: Kagami Hiiragi Date: Sat, 20 Dec 2014 13:48:12 +0300 Subject: [PATCH] Use native assert --- lib/address.js | 2 +- lib/crypto.browser.js | 2 +- lib/utils.js | 7 ------- lib/varint.js | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 lib/utils.js diff --git a/lib/address.js b/lib/address.js index 1d28490..c055106 100644 --- a/lib/address.js +++ b/lib/address.js @@ -5,11 +5,11 @@ "use strict"; +var assert = require("assert"); var bufferEqual = require("buffer-equal"); var bs58 = require("bs58"); var varint = require("./varint"); var bmcrypto = require("./crypto"); -var assert = require("./utils").assert; /** * Parse Bitmessage Base58 encoded address (with or without `BM-` diff --git a/lib/crypto.browser.js b/lib/crypto.browser.js index 7415e1a..8052a8e 100644 --- a/lib/crypto.browser.js +++ b/lib/crypto.browser.js @@ -10,9 +10,9 @@ "use strict"; +var assert = require("assert"); require("es6-promise").polyfill(); var ripemd160 = require("ripemd160"); -var assert = require("./utils").assert; // Support `webkit` prefix for Safari (not tested yet). // TODO(Kagami): Try to support IE11. diff --git a/lib/utils.js b/lib/utils.js deleted file mode 100644 index ffe85a2..0000000 --- a/lib/utils.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -exports.assert = function(condition, message) { - if (!condition) { - throw new Error(message || "Assertion failed"); - } -}; diff --git a/lib/varint.js b/lib/varint.js index ee9e8d8..c1a969d 100644 --- a/lib/varint.js +++ b/lib/varint.js @@ -5,12 +5,12 @@ "use strict"; +var assert = require("assert"); // TODO(Kagami): Since `node-int64` and `int64-native` APIs are slightly // differ, there might be need in platform-dependent wrapper. Also think // that to do with 64bit arithmetic since `node-int64` doesn't implement // it. var Int64 = require("int64-native"); -var assert = require("./utils").assert; exports.decode = function(buf) { assert(buf.length > 0, "Empty buffer");