|
|
@ -1,5 +1,6 @@ |
|
|
|
'use strict' |
|
|
|
'use strict' |
|
|
|
import { BN, bufferToHex, keccak, setLengthLeft, toBuffer, addHexPrefix } from 'ethereumjs-util' |
|
|
|
import { BN, bufferToHex, keccak, setLengthLeft, toBuffer, addHexPrefix } from 'ethereumjs-util' |
|
|
|
|
|
|
|
import stringSimilarity from 'string-similarity' |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
contains misc util: @TODO should be splitted |
|
|
|
contains misc util: @TODO should be splitted |
|
|
@ -222,8 +223,9 @@ export function compareByteCode (code1, code2) { |
|
|
|
code2 = this.extractSwarmHash(code2) |
|
|
|
code2 = this.extractSwarmHash(code2) |
|
|
|
code2 = this.extractcborMetadata(code2) |
|
|
|
code2 = this.extractcborMetadata(code2) |
|
|
|
|
|
|
|
|
|
|
|
if (code1 && code2 && code1.indexOf(code2) === 0) { |
|
|
|
if (code1 && code2) { |
|
|
|
return true |
|
|
|
const compare = stringSimilarity.compareTwoStrings(code1, code2) |
|
|
|
|
|
|
|
return compare > 0.5 |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|