Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect side-effects in method arguments of unknown strings (#2476)
- Loading branch information
1 parent
7f4b543
commit 177b95e
Showing
3 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
test/function/samples/builtin-prototypes/argument-side-effects/_config.js
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,3 @@ | ||
module.exports = { | ||
description: 'detects side-effects in chained string method arguments' | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/function/samples/builtin-prototypes/argument-side-effects/main.js
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,11 @@ | ||
function getData() { | ||
var data = []; | ||
|
||
'abc'.trim().replace('b', function() { | ||
data.push('replaced'); | ||
}); | ||
|
||
return data; | ||
} | ||
|
||
assert.deepEqual(getData(), ['replaced']); |