{"action":"created","issue":{"url":"https://api.github.com/repos/dgilland/pydash/issues/107","repository_url":"https://api.github.com/repos/dgilland/pydash","labels_url":"https://api.github.com/repos/dgilland/pydash/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/dgilland/pydash/issues/107/comments","events_url":"https://api.github.com/repos/dgilland/pydash/issues/107/events","html_url":"https://github.com/dgilland/pydash/pull/107","id":270223065,"number":107,"title":"simplify usage of potentially single values","user":{"login":"efenka","id":2083099,"avatar_url":"https://avatars0.githubusercontent.com/u/2083099?v=4","gravatar_id":"","url":"https://api.github.com/users/efenka","html_url":"https://github.com/efenka","followers_url":"https://api.github.com/users/efenka/followers","following_url":"https://api.github.com/users/efenka/following{/other_user}","gists_url":"https://api.github.com/users/efenka/gists{/gist_id}","starred_url":"https://api.github.com/users/efenka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/efenka/subscriptions","organizations_url":"https://api.github.com/users/efenka/orgs","repos_url":"https://api.github.com/users/efenka/repos","events_url":"https://api.github.com/users/efenka/events{/privacy}","received_events_url":"https://api.github.com/users/efenka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-11-01T07:41:11Z","updated_at":"2017-11-01T20:12:01Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/dgilland/pydash/pulls/107","html_url":"https://github.com/dgilland/pydash/pull/107","diff_url":"https://github.com/dgilland/pydash/pull/107.diff","patch_url":"https://github.com/dgilland/pydash/pull/107.patch"},"body":"I often have the problem that i don't know if a value given by a user is a list or a single value. My API allows to give for example a list of database ids to work on or just a single id. For this reason i have to check if the given value is already a list / tuple and if not, transform it before i can apply further pydash functions.\r\n\r\nFor this reason it would be nice to have a pydash function that wraps single values in a list. Especially for chaining.\r\n\r\nMy issue:\r\n```\r\n>>> py_(1).sum().value()\r\n0\r\n```\r\n\r\nSimplification using listify:\r\n```\r\n>>> listify(1)\r\n[1]\r\n```\r\n\r\n```\r\n>>> listify([1])\r\n[1]\r\n```\r\n\r\n```\r\n>>> listify({1: 2, 3: 4})\r\n[1, 3]\r\n```\r\n\r\n```\r\n>>> listify(a for a in [1, 2, 3])\r\n[1, 2, 3]\r\n```\r\n\r\nChained:\r\n```\r\n>>> py_(1).listify().sum().value()\r\n1\r\n```\r\n\r\n```\r\n>>> py_([1, 2, 3]).listify().sum().value()\r\n6\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dgilland/pydash/issues/comments/341226702","html_url":"https://github.com/dgilland/pydash/pull/107#issuecomment-341226702","issue_url":"https://api.github.com/repos/dgilland/pydash/issues/107","id":341226702,"user":{"login":"efenka","id":2083099,"avatar_url":"https://avatars0.githubusercontent.com/u/2083099?v=4","gravatar_id":"","url":"https://api.github.com/users/efenka","html_url":"https://github.com/efenka","followers_url":"https://api.github.com/users/efenka/followers","following_url":"https://api.github.com/users/efenka/following{/other_user}","gists_url":"https://api.github.com/users/efenka/gists{/gist_id}","starred_url":"https://api.github.com/users/efenka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/efenka/subscriptions","organizations_url":"https://api.github.com/users/efenka/orgs","repos_url":"https://api.github.com/users/efenka/repos","events_url":"https://api.github.com/users/efenka/events{/privacy}","received_events_url":"https://api.github.com/users/efenka/received_events","type":"User","site_admin":false},"created_at":"2017-11-01T20:12:01Z","updated_at":"2017-11-01T20:12:01Z","author_association":"CONTRIBUTOR","body":"Sure :) Should i do it and send you another pull request or want you to modify it yourself?"}}
{"actor":{"display_login":"efenka"}}