{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/3297","labels_url":"https://api.github.com/repos/angular/angular/issues/3297/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/3297/comments","events_url":"https://api.github.com/repos/angular/angular/issues/3297/events","html_url":"https://github.com/angular/angular/issues/3297","id":97285775,"number":3297,"title":"angular2/src/forms/model.ts _find is it right?","user":{"login":"xsilen","id":5467712,"avatar_url":"https://avatars.githubusercontent.com/u/5467712?v=3","gravatar_id":"","url":"https://api.github.com/users/xsilen","html_url":"https://github.com/xsilen","followers_url":"https://api.github.com/users/xsilen/followers","following_url":"https://api.github.com/users/xsilen/following{/other_user}","gists_url":"https://api.github.com/users/xsilen/gists{/gist_id}","starred_url":"https://api.github.com/users/xsilen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xsilen/subscriptions","organizations_url":"https://api.github.com/users/xsilen/orgs","repos_url":"https://api.github.com/users/xsilen/repos","events_url":"https://api.github.com/users/xsilen/events{/privacy}","received_events_url":"https://api.github.com/users/xsilen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/comp:%20core/forms","name":"comp: core/forms","color":"c7def8"},{"url":"https://api.github.com/repos/angular/angular/labels/effort1:%20easy%20(hour)","name":"effort1: easy (hour)","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular/labels/P2:%20required","name":"P2: required","color":"fad8c7"},{"url":"https://api.github.com/repos/angular/angular/labels/state:%20Periodic%20Review","name":"state: Periodic Review","color":"006b75"},{"url":"https://api.github.com/repos/angular/angular/labels/type:%20bug","name":"type: bug","color":"EEEEEE"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-26T04:42:03Z","updated_at":"2015-08-20T23:39:06Z","closed_at":null,"body":"```javascript\r\nfunction _find(c: AbstractControl, path: List<string | number>| string) {\r\n  if (isBlank(path)) return null;\r\n  if (!(path instanceof List)) {\r\n    path = StringWrapper.split(<string>path, new RegExp(\"/\"));\r\n  }\r\n  if (path instanceof List && ListWrapper.isEmpty(path)) return null;\r\n\r\n  return ListWrapper.reduce(<List<string | number>>path, (v, name) => {\r\n    if (v instanceof ControlGroup) {\r\n      return isPresent(v.controls[name]) ? v.controls[name] : null~~~~;\r\n    } else if (v instanceof ControlArray) {\r\n      var index = <number>name;\r\n      return isPresent(v.at(index)) ? v.at(index) : null~~~~;\r\n    } else {\r\n      return null~~~~;\r\n    }\r\n  }, c);\r\n}\r\n```\r\nIts return `null` in lambda function, so how to handle the List of path, the param `v` will be null in Array.reduce execute the function next time\r\n```javascript\r\n[0,1,2,3,4].reduce(function(previousValue, currentValue, index, array){\r\n    console.log(previousValue)\r\n    return null;\r\n}, 10);\r\n//result:\r\n10\r\nnull\r\nnull\r\nnull\r\nnull\r\n```\r\ni think code should be like this\r\n```javascript\r\nfunction _find(c: AbstractControl, path: List<string | number>| string) {\r\n  if (isBlank(path)) return null;\r\n  if (!(path instanceof List)) {\r\n    path = StringWrapper.split(<string>path, new RegExp(\"/\"));\r\n  }\r\n  if (path instanceof List && ListWrapper.isEmpty(path)) return null;\r\n\r\n  var rtn = ListWrapper.reduce(<List<string | number>>path, (v, name) => {\r\n    if (v instanceof ControlGroup) {\r\n      return isPresent(v.controls[name]) ? v.controls[name] : v;\r\n    } else if (v instanceof ControlArray) {\r\n      var index = <number>name;\r\n      return isPresent(v.at(index)) ? v.at(index) : v;\r\n    } else {\r\n      return v;\r\n    }\r\n  }, c);\r\n\r\n  return rtn === c ? null : rtn;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/133211810","html_url":"https://github.com/angular/angular/issues/3297#issuecomment-133211810","issue_url":"https://api.github.com/repos/angular/angular/issues/3297","id":133211810,"user":{"login":"mhevery","id":111951,"avatar_url":"https://avatars.githubusercontent.com/u/111951?v=3","gravatar_id":"","url":"https://api.github.com/users/mhevery","html_url":"https://github.com/mhevery","followers_url":"https://api.github.com/users/mhevery/followers","following_url":"https://api.github.com/users/mhevery/following{/other_user}","gists_url":"https://api.github.com/users/mhevery/gists{/gist_id}","starred_url":"https://api.github.com/users/mhevery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhevery/subscriptions","organizations_url":"https://api.github.com/users/mhevery/orgs","repos_url":"https://api.github.com/users/mhevery/repos","events_url":"https://api.github.com/users/mhevery/events{/privacy}","received_events_url":"https://api.github.com/users/mhevery/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T23:39:06Z","updated_at":"2015-08-20T23:39:06Z","body":"Ping @vsavkin "}}