CloneSet114


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
26250.959SourceElements[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
126415
Closure/closure/goog/array/array.js
226455
Closure/closure/goog/array/array.js
Clone Instance
1
Line Count
26
Source Line
415
Source File
Closure/closure/goog/array/array.js

/**
 * Search an array for the first element that satisfies a given condition and
 * return that element.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {*} The first array element that passes the test, or null if no
 *     element is found.
 */
goog.array.find=  function (arr, f, opt_obj){
  var i=  goog.array.findIndex(arr, f, opt_obj);
  return i<  0
         ?       null
         :              goog.isString(arr)
                        ?                    arr.charAt(i)
                        :                                    arr[i];
                                            } ;
/**
 * Search an array for the first element that satisfies a given condition and
 * return its index.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {number} The index of the first array element that passes the test,
 *     or -1 if no element is found.
 */
goog.array.findIndex=  function (arr, f, opt_obj){
  var l=  arr.length;  // must be fixed during loop... see docs
  var arr2=  goog.isString(arr)
             ?                    arr.split('')
             :                                    arr;
  for (var i=  0; i<  l; i++) {
    if (i in arr2
        &&           f.call(opt_obj, arr2[i], i, arr)) {
      return i;
                                                       }
                              }
  return -1;
                                                 } ;


Clone Instance
2
Line Count
26
Source Line
455
Source File
Closure/closure/goog/array/array.js

/**
 * Search an array (in reverse order) for the last element that satisfies a
 * given condition and return that element.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {*} The last array element that passes the test, or null if no
 *     element is found.
 */
goog.array.findRight=  function (arr, f, opt_obj){
  var i=  goog.array.findIndexRight(arr, f, opt_obj);
  return i<  0
         ?       null
         :              goog.isString(arr)
                        ?                    arr.charAt(i)
                        :                                    arr[i];
                                                 } ;
/**
 * Search an array (in reverse order) for the last element that satisfies a
 * given condition and return its index.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {number} The index of the last array element that passes the test,
 *     or -1 if no element is found.
 */
goog.array.findIndexRight=  function (arr, f, opt_obj){
  var l=  arr.length;  // must be fixed during loop... see docs
  var arr2=  goog.isString(arr)
             ?                    arr.split('')
             :                                    arr;
  for (var i=  l-  1; i>=  0; i--) {
    if (i in arr2
        &&           f.call(opt_obj, arr2[i], i, arr)) {
      return i;
                                                       }
                                   }
  return -1;
                                                      } ;


Clone AbstractionParameter Count: 5Parameter Bindings

/**
 * Search an array for the first element that satisfies a given condition and
 * return that element.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {*} The first array element that passes the test, or null if no
 *     element is found.
 */
/**
 * Search an array (in reverse order) for the last element that satisfies a
 * given condition and return that element.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {*} The last array element that passes the test, or null if no
 *     element is found.
 */
goog.array. [[#variable5ff868a0]]= function (arr,f,opt_obj)
                                   { var i=goog.array. [[#variable5ff86860]](arr,f,opt_obj);
                                     return i<0
                                            ?null
                                            :goog.isString(arr)
                                             ?arr.charAt(i)
                                             :arr[i];
                                   } ;
/**
 * Search an array for the first element that satisfies a given condition and
 * return its index.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {number} The index of the first array element that passes the test,
 *     or -1 if no element is found.
 */
/**
 * Search an array (in reverse order) for the last element that satisfies a
 * given condition and return its index.
 * @param {goog.array.ArrayLike} arr The array to search.
 * @param {Function} f The function to call for every element. This function
 *     takes 3 arguments (the element, the index and the array) and should
 *     return a boolean.
 * @param {Object=} opt_obj An optional "this" context for the function.
 * @return {number} The index of the last array element that passes the test,
 *     or -1 if no element is found.
 */
goog.array. [[#variable5ff86860]]= function (arr,f,opt_obj)
                                   { var l=arr.length; // must be fixed during loop... see docs
                                     var arr2=goog.isString(arr)
                                              ?arr.split('')
                                              :arr;
                                     for (var i= [[#variable5ff867e0]]; [[#variable5ff86720]]; [[#variable5ff866e0]])
                                       { if (i in arr2
                                             && f.call(opt_obj,arr2[i],i,arr))
                                           { return i;
                                           }
                                       }
                                     return -1;
                                   } ;
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#5ff868a0]]
find 
12[[#5ff868a0]]
findRight 
21[[#5ff86860]]
findIndex 
22[[#5ff86860]]
findIndexRight 
31[[#5ff867e0]]
0 
32[[#5ff867e0]]
l-1 
41[[#5ff86720]]
i<l 
42[[#5ff86720]]
i>=0 
51[[#5ff866e0]]
i++ 
52[[#5ff866e0]]
i--