Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: tracing/tracing/base/iteration_helpers.html

Issue 2955053002: Remove tr.b.identity. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tracing/tracing/base/iteration_helpers_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/base/iteration_helpers.html
diff --git a/tracing/tracing/base/iteration_helpers.html b/tracing/tracing/base/iteration_helpers.html
index 18e5eb8e7a638cdec5f6191a3252cb63bca5157d..1f27fb71bfb5ce64ca878869563521cc104183d3 100644
--- a/tracing/tracing/base/iteration_helpers.html
+++ b/tracing/tracing/base/iteration_helpers.html
@@ -263,11 +263,6 @@ tr.exportTo('tr.b', function() {
return result;
}
- /** Returns the value passed in. */
- function identity(d) {
- return d;
- }
-
/**
* Returns the index of the first element in |ary| for which |opt_func|
* returns a truthy value.
@@ -279,7 +274,7 @@ tr.exportTo('tr.b', function() {
* @param {*=} opt_this Optional 'this' context for opt_func.
*/
function findFirstIndexInArray(ary, opt_func, opt_this) {
- const func = opt_func || identity;
+ const func = opt_func || (x => x);
for (let i = 0; i < ary.length; i++) {
if (func.call(opt_this, ary[i], i)) return i;
}
@@ -314,7 +309,7 @@ tr.exportTo('tr.b', function() {
* @param {*=} opt_this Optional 'this' context for opt_func.
*/
function findFirstKeyInDictMatching(dict, opt_func, opt_this) {
- const func = opt_func || identity;
+ const func = opt_func || (x => x);
for (const key in dict) {
if (func.call(opt_this, key, dict[key])) {
return key;
@@ -356,7 +351,6 @@ tr.exportTo('tr.b', function() {
inPlaceFilter,
invertArrayOfDicts,
arrayToDict,
- identity,
findFirstIndexInArray,
findFirstInArray,
findFirstKeyInDictMatching,
« no previous file with comments | « no previous file | tracing/tracing/base/iteration_helpers_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698