{"action":"created","comment":{"url":"https://api.github.com/repos/openlayers/ol3/pulls/comments/50120260","id":50120260,"diff_hunk":"@@ -127,3 +164,153 @@ ol.array.reverseSubArray = function(arr, begin, end) {\n     --end;\n   }\n };\n+\n+\n+/**\n+ * @param {Array.<*>} arr Array.\n+ * @return {!Array<?>} Flattened Array.\n+ */\n+ol.array.flatten = function(arr) {\n+  var data = arr.reduce(function(flattened, value) {\n+    if (goog.isArray(value)) {\n+      return flattened.concat(ol.array.flatten(value));\n+    } else {\n+      return flattened.concat(value);\n+    }\n+  }, []);\n+  return data;\n+};\n+\n+\n+// TODO: Optimisation by storing length or iterating backwards etc\n+/**\n+ * @param {Array<VALUE>} arr  The array to modify.\n+ * @param {Array<VALUE>|VALUE} data The elements or arrays of elements\n+ *     to add to arr1.\n+ * @template VALUE\n+ */\n+ol.array.extend = function(arr, data) {\n+  var i;\n+  var extension = goog.isArrayLike(data) ? data : [data];\n+  for (i = 0; i < extension.length; i++) {\n+    arr[arr.length] = extension[i];\n+  }\n+}\n+\n+\n+/**\n+ * @param {Array<VALUE>} arr  The array to modify.\n+ * @param {VALUE} obj The element to remove.\n+ * @template VALUE\n+ * @return {boolean} If the element was removed.\n+ */\n+ol.array.remove = function(arr, obj) {\n+  var i = arr.indexOf(obj);\n+  if (i > -1) {\n+    arr.splice(i, 1);\n+  }\n+  return i > -1;\n+}\n+\n+\n+/**\n+ * @param {Array<VALUE>} arr  The array to modify.\n+ * @param {?function(this:THISVAL, VALUE, number, ?) : boolean} func The function to compare.\n+ * @param {THISVAL=} opt_thisArg Optional this argument for the function.\n+ * @template VALUE,THISVAL\n+ * @return {VALUE} If the element was removed.\n+ */\n+ol.array.find = function(arr, func, opt_thisArg) {\n+  if (typeof func !== 'function') {\n+    throw new TypeError('func must be a function');\n+  }\n+  var list = Object(arr);\n+  var length = list.length >>> 0;\n+  var value;\n+\n+  for (var i = 0; i < length; i++) {\n+    value = list[i];\n+    if (func.call(opt_thisArg, value, i, list)) {\n+      return value;\n+    }\n+  }\n+  return null;\n+}\n+\n+\n+/**\n+* @param {Array|NodeList|Arguments|{length: number}} arr1 The first array to compare.\n+* @param {Array|NodeList|Arguments|{length: number}} arr2 The second array to compare.\n+* @param {Function=} opt_equalsFn Optional comparison function.\n+* @return {boolean} Whether the two arrays are equal.\n+ */\n+ol.array.equals = function(arr1, arr2, opt_equalsFn) {\n+  if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length !== arr2.length) {\n+    return false;\n+  }\n+  var length = arr1.length;\n+  var equalsFn = opt_equalsFn !== undefined ? opt_equalsFn : function(a, b) {\n+    return a === b;\n+  };\n+  for (var i = 0; i < length; i++) {\n+    if (!equalsFn(arr1[i], arr2[i])) {\n+      return false;\n+    }\n+  }\n+  return true;\n+}\n+\n+ol.array.stableSort = function(arr, compareFnc) {\n+  var length = arr.length;\n+  var tmp = Array(arr.length);\n+  var i;\n+  for (i = 0; i < length; i++) {\n+    tmp[i] = {index: i, value: arr[i]};\n+  }\n+  var compare = compareFnc || function(a, b) {\n+    return a > b ? 1 : a < b ? -1 : 0;\n+  };\n+  tmp.sort(function(a, b) {\n+    return compare(a.value, b.value) || a.index - b.index;\n+  });\n+  for (i = 0; i < arr.length; i++) {\n+    arr[i] = tmp[i].value;\n+  }\n+}\n+\n+\n+/**\n+* @param {Array<*>} arr The first array to compare..\n+* @param {Function} func Optional comparison function.\n+* @param {*=} opt_thisArg Optional this argument for the function.","path":"src/ol/array.js","position":178,"original_position":178,"commit_id":"ec0e9efc512d03760ac3b8804ea6ec867decac78","original_commit_id":"ec0e9efc512d03760ac3b8804ea6ec867decac78","user":{"login":"ahocevar","id":211514,"avatar_url":"https://avatars.githubusercontent.com/u/211514?v=3","gravatar_id":"","url":"https://api.github.com/users/ahocevar","html_url":"https://github.com/ahocevar","followers_url":"https://api.github.com/users/ahocevar/followers","following_url":"https://api.github.com/users/ahocevar/following{/other_user}","gists_url":"https://api.github.com/users/ahocevar/gists{/gist_id}","starred_url":"https://api.github.com/users/ahocevar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahocevar/subscriptions","organizations_url":"https://api.github.com/users/ahocevar/orgs","repos_url":"https://api.github.com/users/ahocevar/repos","events_url":"https://api.github.com/users/ahocevar/events{/privacy}","received_events_url":"https://api.github.com/users/ahocevar/received_events","type":"User","site_admin":false},"body":"We don't need `opt_thisArg`.","created_at":"2016-01-19T14:50:24Z","updated_at":"2016-01-19T14:50:24Z","html_url":"https://github.com/openlayers/ol3/pull/4680#discussion_r50120260","pull_request_url":"https://api.github.com/repos/openlayers/ol3/pulls/4680","_links":{"self":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/comments/50120260"},"html":{"href":"https://github.com/openlayers/ol3/pull/4680#discussion_r50120260"},"pull_request":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/4680"}}},"pull_request":{"url":"https://api.github.com/repos/openlayers/ol3/pulls/4680","id":56267593,"html_url":"https://github.com/openlayers/ol3/pull/4680","diff_url":"https://github.com/openlayers/ol3/pull/4680.diff","patch_url":"https://github.com/openlayers/ol3/pull/4680.patch","issue_url":"https://api.github.com/repos/openlayers/ol3/issues/4680","number":4680,"state":"open","locked":false,"title":"Remove goog array","user":{"login":"nicholas-l","id":12977174,"avatar_url":"https://avatars.githubusercontent.com/u/12977174?v=3","gravatar_id":"","url":"https://api.github.com/users/nicholas-l","html_url":"https://github.com/nicholas-l","followers_url":"https://api.github.com/users/nicholas-l/followers","following_url":"https://api.github.com/users/nicholas-l/following{/other_user}","gists_url":"https://api.github.com/users/nicholas-l/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholas-l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholas-l/subscriptions","organizations_url":"https://api.github.com/users/nicholas-l/orgs","repos_url":"https://api.github.com/users/nicholas-l/repos","events_url":"https://api.github.com/users/nicholas-l/events{/privacy}","received_events_url":"https://api.github.com/users/nicholas-l/received_events","type":"User","site_admin":false},"body":"Remove the use of goog.array functions for ES5/ES5.1","created_at":"2016-01-17T01:11:13Z","updated_at":"2016-01-19T14:50:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"503e367a741bb3bb04571749429201a0b1bc07b9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openlayers/ol3/pulls/4680/commits","review_comments_url":"https://api.github.com/repos/openlayers/ol3/pulls/4680/comments","review_comment_url":"https://api.github.com/repos/openlayers/ol3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openlayers/ol3/issues/4680/comments","statuses_url":"https://api.github.com/repos/openlayers/ol3/statuses/ec0e9efc512d03760ac3b8804ea6ec867decac78","head":{"label":"nicholas-l:removeGoogArray","ref":"removeGoogArray","sha":"ec0e9efc512d03760ac3b8804ea6ec867decac78","user":{"login":"nicholas-l","id":12977174,"avatar_url":"https://avatars.githubusercontent.com/u/12977174?v=3","gravatar_id":"","url":"https://api.github.com/users/nicholas-l","html_url":"https://github.com/nicholas-l","followers_url":"https://api.github.com/users/nicholas-l/followers","following_url":"https://api.github.com/users/nicholas-l/following{/other_user}","gists_url":"https://api.github.com/users/nicholas-l/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholas-l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholas-l/subscriptions","organizations_url":"https://api.github.com/users/nicholas-l/orgs","repos_url":"https://api.github.com/users/nicholas-l/repos","events_url":"https://api.github.com/users/nicholas-l/events{/privacy}","received_events_url":"https://api.github.com/users/nicholas-l/received_events","type":"User","site_admin":false},"repo":{"id":49265368,"name":"ol3","full_name":"nicholas-l/ol3","owner":{"login":"nicholas-l","id":12977174,"avatar_url":"https://avatars.githubusercontent.com/u/12977174?v=3","gravatar_id":"","url":"https://api.github.com/users/nicholas-l","html_url":"https://github.com/nicholas-l","followers_url":"https://api.github.com/users/nicholas-l/followers","following_url":"https://api.github.com/users/nicholas-l/following{/other_user}","gists_url":"https://api.github.com/users/nicholas-l/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholas-l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholas-l/subscriptions","organizations_url":"https://api.github.com/users/nicholas-l/orgs","repos_url":"https://api.github.com/users/nicholas-l/repos","events_url":"https://api.github.com/users/nicholas-l/events{/privacy}","received_events_url":"https://api.github.com/users/nicholas-l/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicholas-l/ol3","description":"OpenLayers 3","fork":true,"url":"https://api.github.com/repos/nicholas-l/ol3","forks_url":"https://api.github.com/repos/nicholas-l/ol3/forks","keys_url":"https://api.github.com/repos/nicholas-l/ol3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicholas-l/ol3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicholas-l/ol3/teams","hooks_url":"https://api.github.com/repos/nicholas-l/ol3/hooks","issue_events_url":"https://api.github.com/repos/nicholas-l/ol3/issues/events{/number}","events_url":"https://api.github.com/repos/nicholas-l/ol3/events","assignees_url":"https://api.github.com/repos/nicholas-l/ol3/assignees{/user}","branches_url":"https://api.github.com/repos/nicholas-l/ol3/branches{/branch}","tags_url":"https://api.github.com/repos/nicholas-l/ol3/tags","blobs_url":"https://api.github.com/repos/nicholas-l/ol3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicholas-l/ol3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicholas-l/ol3/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicholas-l/ol3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicholas-l/ol3/statuses/{sha}","languages_url":"https://api.github.com/repos/nicholas-l/ol3/languages","stargazers_url":"https://api.github.com/repos/nicholas-l/ol3/stargazers","contributors_url":"https://api.github.com/repos/nicholas-l/ol3/contributors","subscribers_url":"https://api.github.com/repos/nicholas-l/ol3/subscribers","subscription_url":"https://api.github.com/repos/nicholas-l/ol3/subscription","commits_url":"https://api.github.com/repos/nicholas-l/ol3/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicholas-l/ol3/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicholas-l/ol3/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicholas-l/ol3/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicholas-l/ol3/contents/{+path}","compare_url":"https://api.github.com/repos/nicholas-l/ol3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicholas-l/ol3/merges","archive_url":"https://api.github.com/repos/nicholas-l/ol3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicholas-l/ol3/downloads","issues_url":"https://api.github.com/repos/nicholas-l/ol3/issues{/number}","pulls_url":"https://api.github.com/repos/nicholas-l/ol3/pulls{/number}","milestones_url":"https://api.github.com/repos/nicholas-l/ol3/milestones{/number}","notifications_url":"https://api.github.com/repos/nicholas-l/ol3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicholas-l/ol3/labels{/name}","releases_url":"https://api.github.com/repos/nicholas-l/ol3/releases{/id}","created_at":"2016-01-08T10:16:00Z","updated_at":"2016-01-16T07:28:57Z","pushed_at":"2016-01-18T20:08:36Z","git_url":"git://github.com/nicholas-l/ol3.git","ssh_url":"git@github.com:nicholas-l/ol3.git","clone_url":"https://github.com/nicholas-l/ol3.git","svn_url":"https://github.com/nicholas-l/ol3","homepage":"http://openlayers.org","size":54124,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openlayers:master","ref":"master","sha":"5961431505a5cbb85c72194674ff7d7b35eb6296","user":{"login":"openlayers","id":240579,"avatar_url":"https://avatars.githubusercontent.com/u/240579?v=3","gravatar_id":"","url":"https://api.github.com/users/openlayers","html_url":"https://github.com/openlayers","followers_url":"https://api.github.com/users/openlayers/followers","following_url":"https://api.github.com/users/openlayers/following{/other_user}","gists_url":"https://api.github.com/users/openlayers/gists{/gist_id}","starred_url":"https://api.github.com/users/openlayers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlayers/subscriptions","organizations_url":"https://api.github.com/users/openlayers/orgs","repos_url":"https://api.github.com/users/openlayers/repos","events_url":"https://api.github.com/users/openlayers/events{/privacy}","received_events_url":"https://api.github.com/users/openlayers/received_events","type":"Organization","site_admin":false},"repo":{"id":4723248,"name":"ol3","full_name":"openlayers/ol3","owner":{"login":"openlayers","id":240579,"avatar_url":"https://avatars.githubusercontent.com/u/240579?v=3","gravatar_id":"","url":"https://api.github.com/users/openlayers","html_url":"https://github.com/openlayers","followers_url":"https://api.github.com/users/openlayers/followers","following_url":"https://api.github.com/users/openlayers/following{/other_user}","gists_url":"https://api.github.com/users/openlayers/gists{/gist_id}","starred_url":"https://api.github.com/users/openlayers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlayers/subscriptions","organizations_url":"https://api.github.com/users/openlayers/orgs","repos_url":"https://api.github.com/users/openlayers/repos","events_url":"https://api.github.com/users/openlayers/events{/privacy}","received_events_url":"https://api.github.com/users/openlayers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openlayers/ol3","description":"OpenLayers 3","fork":false,"url":"https://api.github.com/repos/openlayers/ol3","forks_url":"https://api.github.com/repos/openlayers/ol3/forks","keys_url":"https://api.github.com/repos/openlayers/ol3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openlayers/ol3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openlayers/ol3/teams","hooks_url":"https://api.github.com/repos/openlayers/ol3/hooks","issue_events_url":"https://api.github.com/repos/openlayers/ol3/issues/events{/number}","events_url":"https://api.github.com/repos/openlayers/ol3/events","assignees_url":"https://api.github.com/repos/openlayers/ol3/assignees{/user}","branches_url":"https://api.github.com/repos/openlayers/ol3/branches{/branch}","tags_url":"https://api.github.com/repos/openlayers/ol3/tags","blobs_url":"https://api.github.com/repos/openlayers/ol3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openlayers/ol3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openlayers/ol3/git/refs{/sha}","trees_url":"https://api.github.com/repos/openlayers/ol3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openlayers/ol3/statuses/{sha}","languages_url":"https://api.github.com/repos/openlayers/ol3/languages","stargazers_url":"https://api.github.com/repos/openlayers/ol3/stargazers","contributors_url":"https://api.github.com/repos/openlayers/ol3/contributors","subscribers_url":"https://api.github.com/repos/openlayers/ol3/subscribers","subscription_url":"https://api.github.com/repos/openlayers/ol3/subscription","commits_url":"https://api.github.com/repos/openlayers/ol3/commits{/sha}","git_commits_url":"https://api.github.com/repos/openlayers/ol3/git/commits{/sha}","comments_url":"https://api.github.com/repos/openlayers/ol3/comments{/number}","issue_comment_url":"https://api.github.com/repos/openlayers/ol3/issues/comments{/number}","contents_url":"https://api.github.com/repos/openlayers/ol3/contents/{+path}","compare_url":"https://api.github.com/repos/openlayers/ol3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openlayers/ol3/merges","archive_url":"https://api.github.com/repos/openlayers/ol3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openlayers/ol3/downloads","issues_url":"https://api.github.com/repos/openlayers/ol3/issues{/number}","pulls_url":"https://api.github.com/repos/openlayers/ol3/pulls{/number}","milestones_url":"https://api.github.com/repos/openlayers/ol3/milestones{/number}","notifications_url":"https://api.github.com/repos/openlayers/ol3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openlayers/ol3/labels{/name}","releases_url":"https://api.github.com/repos/openlayers/ol3/releases{/id}","created_at":"2012-06-20T06:53:59Z","updated_at":"2016-01-19T08:04:47Z","pushed_at":"2016-01-19T14:48:21Z","git_url":"git://github.com/openlayers/ol3.git","ssh_url":"git@github.com:openlayers/ol3.git","clone_url":"https://github.com/openlayers/ol3.git","svn_url":"https://github.com/openlayers/ol3","homepage":"http://openlayers.org","size":96909,"stargazers_count":1603,"watchers_count":1603,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":880,"mirror_url":null,"open_issues_count":381,"forks":880,"open_issues":381,"watchers":1603,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/4680"},"html":{"href":"https://github.com/openlayers/ol3/pull/4680"},"issue":{"href":"https://api.github.com/repos/openlayers/ol3/issues/4680"},"comments":{"href":"https://api.github.com/repos/openlayers/ol3/issues/4680/comments"},"review_comments":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/4680/comments"},"review_comment":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/4680/commits"},"statuses":{"href":"https://api.github.com/repos/openlayers/ol3/statuses/ec0e9efc512d03760ac3b8804ea6ec867decac78"}}}}