diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-07 20:04:58 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-07 20:04:58 +0800 |
commit | 9e67e12732a0fc87f0000917e6bbf21c3c2db260 (patch) | |
tree | d3ae0b94d8b794bb0a90c0082e29a4172a6eb615 /packages/sol-cov/src/utils.ts | |
parent | 2d30183d658c9d178544e1c14fb779306e5d2778 (diff) | |
download | dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.tar dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.tar.gz dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.tar.bz2 dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.tar.lz dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.tar.xz dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.tar.zst dexon-sol-tools-9e67e12732a0fc87f0000917e6bbf21c3c2db260.zip |
Add removeHexPrefix util method
Diffstat (limited to 'packages/sol-cov/src/utils.ts')
-rw-r--r-- | packages/sol-cov/src/utils.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/sol-cov/src/utils.ts b/packages/sol-cov/src/utils.ts index f155043a1..d970c42ee 100644 --- a/packages/sol-cov/src/utils.ts +++ b/packages/sol-cov/src/utils.ts @@ -4,6 +4,10 @@ export const utils = { compareLineColumn(lhs: LineColumn, rhs: LineColumn): number { return lhs.line !== rhs.line ? lhs.line - rhs.line : lhs.column - rhs.column; }, + removeHexPrefix(hex: string): string { + const hexPrefix = '0x'; + return hex.startsWith(hexPrefix) ? hex.slice(hexPrefix.length) : hex; + }, isRangeInside(childRange: SingleFileSourceRange, parentRange: SingleFileSourceRange): boolean { return ( utils.compareLineColumn(parentRange.start, childRange.start) <= 0 && |