Skip to content

Commit

Permalink
Implement review comment changes for PR spiermar#155 Issue spiermar#144
Browse files Browse the repository at this point in the history
… - Keep default behaviour as case-sensitive
  • Loading branch information
rohchakr committed Apr 22, 2020
1 parent 7327707 commit da51770
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ If called with no arguments, `setColorMapper` will reset the color hash function
<a name="setSearchMatch" href="#setSearchMatch">#</a> flamegraph.<b>setSearchMatch</b>(<i>[function]</i>)

Replaces the built-in node search match function. Function takes three arguments,
the node data structure, the search term and an optional boolean argument for case-sensitive search. If the third argument is not provided, the search will not be case-sensitive. It must return a boolean. Example:
the node data structure, the search term and an optional boolean argument to ignore case during search. If the third argument is not provided, the search will be case-sensitive by default. The function must return a boolean. Example:

```js
flamegraph.setSearchMatch(function(d, term, true) {
Expand Down
4 changes: 2 additions & 2 deletions src/flamegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export default function () {
}
var originalSearchHandler = searchHandler

let searchMatch = (d, term, caseSensitive = false) => {
let searchMatch = (d, term, ignoreCase = false) => {
if (!term) {
return false
}
let label = getName(d)
if (!caseSensitive) {
if (ignoreCase) {
term = term.toLowerCase()
label = label.toLowerCase()
}
Expand Down

0 comments on commit da51770

Please sign in to comment.