{"action":"created","issue":{"url":"https://api.github.com/repos/foam-framework/foam/issues/474","labels_url":"https://api.github.com/repos/foam-framework/foam/issues/474/labels{/name}","comments_url":"https://api.github.com/repos/foam-framework/foam/issues/474/comments","events_url":"https://api.github.com/repos/foam-framework/foam/issues/474/events","html_url":"https://github.com/foam-framework/foam/issues/474","id":118581471,"number":474,"title":"Array.removeI has wrong return type and is twice as slow as it needs to be on average","user":{"login":"anicolao","id":1145048,"avatar_url":"https://avatars.githubusercontent.com/u/1145048?v=3","gravatar_id":"","url":"https://api.github.com/users/anicolao","html_url":"https://github.com/anicolao","followers_url":"https://api.github.com/users/anicolao/followers","following_url":"https://api.github.com/users/anicolao/following{/other_user}","gists_url":"https://api.github.com/users/anicolao/gists{/gist_id}","starred_url":"https://api.github.com/users/anicolao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anicolao/subscriptions","organizations_url":"https://api.github.com/users/anicolao/orgs","repos_url":"https://api.github.com/users/anicolao/repos","events_url":"https://api.github.com/users/anicolao/events{/privacy}","received_events_url":"https://api.github.com/users/anicolao/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-24T10:53:59Z","updated_at":"2015-11-24T20:45:43Z","closed_at":"2015-11-24T14:35:19Z","body":" ```javascript\r\n   // Remove first object in this array where predicate 'p' returns true\r\n    function removeI(p) {\r\n      for ( var i = 0 ; i < this.length ; i++ ) {\r\n        if ( p.f(this[i]) ) { this.splice(i, 1); breeak; }\r\n      }\r\n      return this;\r\n    },\r\n```\r\n\r\nshould be \r\n\r\n```javascript\r\n   // Remove first object in this array where predicate 'p' returns true\r\n    function removeI(p) {\r\n      for ( var i = 0 ; i < this.length ; i++ ) {\r\n        if ( p.f(this[i]) ) { this.splice(i, 1); return true; }\r\n      }\r\n      return false;\r\n    },\r\n```\r\n\r\nEven if for some reason you don't think removeI should have the same return type as deleteI, minimally the if in the original should say `break` and not `breeak`. \r\n\r\nWhile you're at it, `removeF` should be defined in terms of `removeI` and `deleteF` should be defined in terms of `deleteI` and unless there's a measurable performance penalty `deleteI` should be defined in terms of `removeI`."},"comment":{"url":"https://api.github.com/repos/foam-framework/foam/issues/comments/159400078","html_url":"https://github.com/foam-framework/foam/issues/474#issuecomment-159400078","issue_url":"https://api.github.com/repos/foam-framework/foam/issues/474","id":159400078,"user":{"login":"kgrgreer","id":7460787,"avatar_url":"https://avatars.githubusercontent.com/u/7460787?v=3","gravatar_id":"","url":"https://api.github.com/users/kgrgreer","html_url":"https://github.com/kgrgreer","followers_url":"https://api.github.com/users/kgrgreer/followers","following_url":"https://api.github.com/users/kgrgreer/following{/other_user}","gists_url":"https://api.github.com/users/kgrgreer/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrgreer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrgreer/subscriptions","organizations_url":"https://api.github.com/users/kgrgreer/orgs","repos_url":"https://api.github.com/users/kgrgreer/repos","events_url":"https://api.github.com/users/kgrgreer/events{/privacy}","received_events_url":"https://api.github.com/users/kgrgreer/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T20:45:43Z","updated_at":"2015-11-24T20:45:43Z","body":"On 24 November 2015 at 15:20, anicolao <notifications@github.com> wrote:\n\n> If removeI and removeF should have the same return type, then why don't\n> deleteI and deleteF also have the same return type?\n>\n\nOkay, I agree.  Pushed change to have removeI() return true iff value\ndeleted, just like deleteI().\n"}}