Skip to content

Commit dab6a11

Browse files
committed
add example code
1 parent 5898b48 commit dab6a11

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

javascript/ql/src/semmle/javascript/StandardLibrary.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ class StringReplaceCall extends DataFlow::MethodCallNode {
150150
map.hasPropertyWrite(old, any(DataFlow::Node repl | repl.getStringValue() = new))
151151
)
152152
or
153+
// str.replace(regex, match => {
154+
// if (match === 'old') return 'new';
155+
// if (match === 'foo') return 'bar';
156+
// ...
157+
// })
153158
exists(
154159
DataFlow::FunctionNode replacer, ConditionGuardNode guard, EqualityTest test,
155160
DataFlow::Node ret

0 commit comments

Comments
 (0)