{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-javascript/issues/7","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-javascript/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-javascript/issues/7/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-javascript/issues/7/events","html_url":"https://github.com/couchbase/couchbase-lite-java-javascript/issues/7","id":32051797,"number":7,"title":"Using array.sort and array.reduce in a view.reduce","user":{"login":"wanderanimrod","id":3718698,"avatar_url":"https://avatars.githubusercontent.com/u/3718698?v=3","gravatar_id":"","url":"https://api.github.com/users/wanderanimrod","html_url":"https://github.com/wanderanimrod","followers_url":"https://api.github.com/users/wanderanimrod/followers","following_url":"https://api.github.com/users/wanderanimrod/following{/other_user}","gists_url":"https://api.github.com/users/wanderanimrod/gists{/gist_id}","starred_url":"https://api.github.com/users/wanderanimrod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanderanimrod/subscriptions","organizations_url":"https://api.github.com/users/wanderanimrod/orgs","repos_url":"https://api.github.com/users/wanderanimrod/repos","events_url":"https://api.github.com/users/wanderanimrod/events{/privacy}","received_events_url":"https://api.github.com/users/wanderanimrod/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-04-23T11:15:23Z","updated_at":"2015-03-24T18:29:09Z","closed_at":null,"body":"Hi, we are trying to use sort and reduce array methods inside our reduce function in a view. We realise that these methods are not available on the javascript array object that is provided with the documents array in the views reduce function. Any ideas or ways that this could be accomplished?"},"comment":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-javascript/issues/comments/85633000","html_url":"https://github.com/couchbase/couchbase-lite-java-javascript/issues/7#issuecomment-85633000","issue_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-javascript/issues/7","id":85633000,"user":{"login":"saubaer","id":498915,"avatar_url":"https://avatars.githubusercontent.com/u/498915?v=3","gravatar_id":"","url":"https://api.github.com/users/saubaer","html_url":"https://github.com/saubaer","followers_url":"https://api.github.com/users/saubaer/followers","following_url":"https://api.github.com/users/saubaer/following{/other_user}","gists_url":"https://api.github.com/users/saubaer/gists{/gist_id}","starred_url":"https://api.github.com/users/saubaer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saubaer/subscriptions","organizations_url":"https://api.github.com/users/saubaer/orgs","repos_url":"https://api.github.com/users/saubaer/repos","events_url":"https://api.github.com/users/saubaer/events{/privacy}","received_events_url":"https://api.github.com/users/saubaer/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T18:29:08Z","updated_at":"2015-03-24T18:29:08Z","body":"keys & values aren't \"real\" JavaScript Arrays.\r\nYou can fix that by using:\r\n```javascript\r\nfunction(keys, values, rereduce) {\r\nkeys = Array.prototype.slice.call(keys);\r\nvalues = Array.prototype.slice.call(values);\r\n// real JavaScript Arrays now\r\n/* your reduce code */\r\n}\r\n```\r\nWell ... a little late, but maybe it helps somebody."}}