diff --git a/packages/ripple-binary-codec/src/binary.js b/packages/ripple-binary-codec/src/binary.js index b0eec033..14a77669 100644 --- a/packages/ripple-binary-codec/src/binary.js +++ b/packages/ripple-binary-codec/src/binary.js @@ -12,7 +12,7 @@ const {sha512Half, transactionID} = require('./hashes'); const makeParser = bytes => new BinaryParser(bytes); const readJSON = parser => parser.readType(types.STObject).toJSON(); -const binaryToJSON = (bytes) => readJSON(makeParser(bytes)); +const binaryToJSON = bytes => readJSON(makeParser(bytes)); function serializeObject(object, opts = {}) { const {prefix, suffix, signingFieldsOnly = false} = opts; diff --git a/packages/ripple-binary-codec/src/signing.js b/packages/ripple-binary-codec/src/signing.js index c4285b51..90f72a38 100644 --- a/packages/ripple-binary-codec/src/signing.js +++ b/packages/ripple-binary-codec/src/signing.js @@ -15,7 +15,7 @@ const { const FULL_CANONICAL_SIGNATURE = 0x80000000; const toHex = v => bytesToHex(v); -const getSigner = (o) => AccountID.from(o.Signer.Account); +const getSigner = o => AccountID.from(o.Signer.Account); const signerComparator = (a, b) => getSigner(a).compareTo(getSigner(b)); function setCanonicalSignatureFlag(tx_json) { diff --git a/packages/ripple-binary-codec/src/utils/make-class.js b/packages/ripple-binary-codec/src/utils/make-class.js index d7f50793..ae0947d4 100644 --- a/packages/ripple-binary-codec/src/utils/make-class.js +++ b/packages/ripple-binary-codec/src/utils/make-class.js @@ -38,8 +38,8 @@ module.exports = function makeClass(klass_, definition_) { klass = function() {}; } const proto = klass.prototype; - function addFunc(original, wrapper) { - proto[original.name] = wrapper || original; + function addFunc(original, name, wrapper) { + proto[name] = wrapper || original; } (definition.getters || []).forEach(k => { const key = '_' + k; @@ -47,24 +47,24 @@ module.exports = function makeClass(klass_, definition_) { return this[key]; }; }); - forEach(definition.virtuals, f => { - addFunc(f, function() { + forEach(definition.virtuals, (f, n) => { + addFunc(f, n, function() { throw new Error('unimplemented'); }); }); forEach(definition.methods, addFunc); - forEach(definition, f => { + forEach(definition, (f, n) => { if (_.isFunction(f) && f !== klass) { - addFunc(f); + addFunc(f, n); } }); _.assign(klass, definition.statics); if (typeof klass.init === 'function') { klass.init(); } - forEach(definition.cached, f => { - const key = '_' + f.name; - addFunc(f, function() { + forEach(definition.cached, (f, n) => { + const key = '_' + n; + addFunc(f, n, function() { let value = this[key]; if (value === undefined) { value = this[key] = f.call(this); diff --git a/packages/ripple-binary-codec/test/binary-serializer-test.js b/packages/ripple-binary-codec/test/binary-serializer-test.js index 2ac824ca..f0fec91e 100644 --- a/packages/ripple-binary-codec/test/binary-serializer-test.js +++ b/packages/ripple-binary-codec/test/binary-serializer-test.js @@ -78,10 +78,10 @@ function UIntTest() { function parseLedger4320278() { - it(`can parse object`, (done) => { + it(`can parse object`, done => { this.timeout(30e3); const json = loadFixture('as-ledger-4320278.json'); - json.forEach((e) => { + json.forEach(e => { assertRecycles(e.binary); }); done();