diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..19d94ee --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": false, + "arrowParens": "always", + "singleQuote": true, + "printWidth": 110 +} diff --git a/src/merkleTree.js b/src/merkleTree.js index 72612ea..c4c0278 100644 --- a/src/merkleTree.js +++ b/src/merkleTree.js @@ -47,9 +47,9 @@ class MerkleTree { for (let i = 0; i < Math.ceil(this._layers[level - 1].length / 2); i++) { this._layers[level][i] = this._hash( this._layers[level - 1][i * 2], - i * 2 + 1 < this._layers[level - 1].length ? - this._layers[level - 1][i * 2 + 1] : - this._zeros[level - 1], + i * 2 + 1 < this._layers[level - 1].length + ? this._layers[level - 1][i * 2 + 1] + : this._zeros[level - 1] ) } } @@ -100,9 +100,9 @@ class MerkleTree { index >>= 1 this._layers[level][index] = this._hash( this._layers[level - 1][index * 2], - index * 2 + 1 < this._layers[level - 1].length ? - this._layers[level - 1][index * 2 + 1] : - this._zeros[level - 1], + index * 2 + 1 < this._layers[level - 1].length + ? this._layers[level - 1][index * 2 + 1] + : this._zeros[level - 1] ) } } @@ -120,9 +120,8 @@ class MerkleTree { const pathIndices = [] for (let level = 0; level < this.levels; level++) { pathIndices[level] = index % 2 - pathElements[level] = (index ^ 1) < this._layers[level].length ? - this._layers[level][index ^ 1] : - this._zeros[level] + pathElements[level] = + (index ^ 1) < this._layers[level].length ? this._layers[level][index ^ 1] : this._zeros[level] index >>= 1 } return {