{"action":"closed","issue":{"url":"https://api.github.com/repos/ralphy15/enumerablejs/issues/21","repository_url":"https://api.github.com/repos/ralphy15/enumerablejs","labels_url":"https://api.github.com/repos/ralphy15/enumerablejs/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/ralphy15/enumerablejs/issues/21/comments","events_url":"https://api.github.com/repos/ralphy15/enumerablejs/issues/21/events","html_url":"https://github.com/ralphy15/enumerablejs/issues/21","id":315650718,"number":21,"title":"asEnumerable for strings","user":{"login":"ralphy15","id":7268444,"avatar_url":"https://avatars3.githubusercontent.com/u/7268444?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphy15","html_url":"https://github.com/ralphy15","followers_url":"https://api.github.com/users/ralphy15/followers","following_url":"https://api.github.com/users/ralphy15/following{/other_user}","gists_url":"https://api.github.com/users/ralphy15/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphy15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphy15/subscriptions","organizations_url":"https://api.github.com/users/ralphy15/orgs","repos_url":"https://api.github.com/users/ralphy15/repos","events_url":"https://api.github.com/users/ralphy15/events{/privacy}","received_events_url":"https://api.github.com/users/ralphy15/received_events","type":"User","site_admin":false},"labels":[{"id":420546217,"url":"https://api.github.com/repos/ralphy15/enumerablejs/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":{"login":"ralphy15","id":7268444,"avatar_url":"https://avatars3.githubusercontent.com/u/7268444?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphy15","html_url":"https://github.com/ralphy15","followers_url":"https://api.github.com/users/ralphy15/followers","following_url":"https://api.github.com/users/ralphy15/following{/other_user}","gists_url":"https://api.github.com/users/ralphy15/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphy15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphy15/subscriptions","organizations_url":"https://api.github.com/users/ralphy15/orgs","repos_url":"https://api.github.com/users/ralphy15/repos","events_url":"https://api.github.com/users/ralphy15/events{/privacy}","received_events_url":"https://api.github.com/users/ralphy15/received_events","type":"User","site_admin":false},"assignees":[{"login":"ralphy15","id":7268444,"avatar_url":"https://avatars3.githubusercontent.com/u/7268444?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphy15","html_url":"https://github.com/ralphy15","followers_url":"https://api.github.com/users/ralphy15/followers","following_url":"https://api.github.com/users/ralphy15/following{/other_user}","gists_url":"https://api.github.com/users/ralphy15/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphy15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphy15/subscriptions","organizations_url":"https://api.github.com/users/ralphy15/orgs","repos_url":"https://api.github.com/users/ralphy15/repos","events_url":"https://api.github.com/users/ralphy15/events{/privacy}","received_events_url":"https://api.github.com/users/ralphy15/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-04-18T21:35:02Z","updated_at":"2018-04-25T23:30:37Z","closed_at":"2018-04-25T23:30:37Z","author_association":"OWNER","body":"Since a string is an array of characters, it would helpful to provide the `asEnumerable()` extension method for strings as well. This method would create an array of characters via the following:\r\n\r\n``` javascript\r\nvar arr = [];\r\n\r\nfor(var i = 0; i < str.length; i++)\r\n{\r\n    arr[i] = str.charAt(i);\r\n}\r\n```\r\n\r\nYou could then have access to any of the asEnumerable functions (any, count, select, where.. etc).\r\n\r\n``` javascript\r\nvar str = \"abcdef\";\r\nstr.asEnumerable().dropLast(4);\r\n//result: \"ab\"\r\n```\r\n\r\nAfter which it becomes necessary to seamlessly convert back to a string. This could be accomplished by overriding the `toString()` method of the array that is created when `asEnumerable()` is called.\r\n\r\n``` javascript\r\nvar arr = [\"a\", \"b\"];\r\nvar result = arr.join('');\r\n// result: \"ab\"\r\n```\r\n\r\nThis would allow syntax like `str.asEnumerable().dropLast(3).toString()` 😄 "}}
{"actor":{"display_login":"ralphy15"}}