This repository has been archived by the owner on Mar 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove remix-lib dep from remix-analyzer
- Loading branch information
Showing
35 changed files
with
25,802 additions
and
28,384 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict' | ||
|
||
export const groupBy = (arr, key) => { | ||
return arr.reduce((sum, item) => { | ||
const groupByVal = item[key] | ||
const groupedItems = sum[groupByVal] || [] | ||
groupedItems.push(item) | ||
sum[groupByVal] = groupedItems | ||
return sum | ||
}, {}) | ||
} | ||
|
||
export const concatWithSeperator = (list, seperator) => { | ||
return list.reduce((sum, item) => sum + item + seperator, '').slice(0, -seperator.length) | ||
} | ||
|
||
export const escapeRegExp = (str) => { | ||
return str.replace(/[-[\]/{}()+?.\\^$|]/g, '\\$&') | ||
} |
2 changes: 1 addition & 1 deletion
2
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict' | ||
import { default as test} from "tape" | ||
import { concatWithSeperator, escapeRegExp, groupBy } from '../../src/util/helpers' | ||
|
||
test('util.concatWithSeperator valid output', function (t) { | ||
t.plan(4) | ||
t.notEqual(concatWithSeperator(['a', 'b', 'c'], ','), 'a, b, c', 'Concat with comma should not produce spaces') | ||
t.equal(concatWithSeperator(['a', 'b', 'c'], ','), 'a,b,c', 'Concat with comma should not produce spaces') | ||
t.equal(concatWithSeperator(['a', 'b', 'c'], ', '), 'a, b, c', 'Concat with comma space should not produce trailing comma') | ||
t.equal(concatWithSeperator(['a', 'b', 'c'], '+'), 'a+b+c', 'Concat with plus') | ||
}) | ||
|
||
test('util.escapeRegExp', function (t) { | ||
t.plan(3) | ||
const original = 'function (uint256) returns (bool)' | ||
t.equal(escapeRegExp('abcd'), 'abcd', 'String with no regex') | ||
t.equal(escapeRegExp(original), 'function \\(uint256\\) returns \\(bool\\)', 'function string with regex') | ||
t.ok(new RegExp(escapeRegExp(original)).test(original), 'should still test for original string') | ||
}) | ||
|
||
test('util.groupBy on valid input', function (t) { | ||
t.plan(1) | ||
|
||
const result = groupBy([ | ||
{category: 'GAS', name: 'a'}, | ||
{category: 'SEC', name: 'b'}, | ||
{category: 'GAS', name: 'c'} | ||
|
||
], 'category') | ||
|
||
const expectedResult = { | ||
'GAS': [ | ||
{category: 'GAS', name: 'a'}, | ||
{category: 'GAS', name: 'c'} | ||
], | ||
'SEC': [ | ||
{category: 'SEC', name: 'b'} | ||
] | ||
} | ||
|
||
t.deepEqual(result, expectedResult) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.