DAVFoundation / xplore

⛓ A block explorer for local Ethereum testnets
MIT License
62 stars 65 forks source link

refactor: refactored and formatted truncate function in utils.js #71

Closed cg-cnu closed 6 years ago

cg-cnu commented 6 years ago

Refactored truncate function and formatted it as mentioned in https://github.com/DAVFoundation/xplore/pull/68

TalAter commented 6 years ago

I merged, but there's actually still a bug in there that needs to be fixed (it was there before your commit).

text.substring(
      text.length - (trailingCharacterCount + 1),
      text.length - 1
    );

This omits the last character because substring only returns the string until the n-th character (excluding it).

xplore_utils_js_at_4e15ab50677717885d78c5a61a6ef5b5c475a277_ _cg-cnu_xplore

Please create a follow-up issue to the community to fix this. I would suggest using slice instead of substring - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice

cg-cnu commented 6 years ago

Created https://github.com/DAVFoundation/xplore/issues/73