{"action":"created","issue":{"url":"https://api.github.com/repos/devrafalko/typeof-arguments/issues/1","repository_url":"https://api.github.com/repos/devrafalko/typeof-arguments","labels_url":"https://api.github.com/repos/devrafalko/typeof-arguments/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/devrafalko/typeof-arguments/issues/1/comments","events_url":"https://api.github.com/repos/devrafalko/typeof-arguments/issues/1/events","html_url":"https://github.com/devrafalko/typeof-arguments/issues/1","id":378744257,"node_id":"MDU6SXNzdWUzNzg3NDQyNTc=","number":1,"title":"Does not support default parameters","user":{"login":"josh-renton","id":8758640,"node_id":"MDQ6VXNlcjg3NTg2NDA=","avatar_url":"https://avatars1.githubusercontent.com/u/8758640?v=4","gravatar_id":"","url":"https://api.github.com/users/josh-renton","html_url":"https://github.com/josh-renton","followers_url":"https://api.github.com/users/josh-renton/followers","following_url":"https://api.github.com/users/josh-renton/following{/other_user}","gists_url":"https://api.github.com/users/josh-renton/gists{/gist_id}","starred_url":"https://api.github.com/users/josh-renton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josh-renton/subscriptions","organizations_url":"https://api.github.com/users/josh-renton/orgs","repos_url":"https://api.github.com/users/josh-renton/repos","events_url":"https://api.github.com/users/josh-renton/events{/privacy}","received_events_url":"https://api.github.com/users/josh-renton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-08T14:01:59Z","updated_at":"2018-11-08T14:47:29Z","closed_at":null,"author_association":"NONE","body":"Hi there, thank you for the package. I was just trying to implement it in my workflows and found that it doesn't support default arguments. Here is an example:\r\n\r\n```\r\nfunction foo (str, bool=false) {\r\n    console.log(bool);\r\n    typeOfArguments(arguments, [String, Boolean]);\r\n}\r\n```\r\nHere is the output:\r\n\r\n```\r\n> foo('test')\r\nfalse\r\nTypeError: Invalid argument [1]. The [undefined] argument has been passed, while the argument of type [Boolean] is expected.\r\n```\r\nIs this something you're thinking to support in the future?\r\n\r\nThanks,\r\n\r\nJosh\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/devrafalko/typeof-arguments/issues/comments/437018426","html_url":"https://github.com/devrafalko/typeof-arguments/issues/1#issuecomment-437018426","issue_url":"https://api.github.com/repos/devrafalko/typeof-arguments/issues/1","id":437018426,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzAxODQyNg==","user":{"login":"devrafalko","id":16205460,"node_id":"MDQ6VXNlcjE2MjA1NDYw","avatar_url":"https://avatars3.githubusercontent.com/u/16205460?v=4","gravatar_id":"","url":"https://api.github.com/users/devrafalko","html_url":"https://github.com/devrafalko","followers_url":"https://api.github.com/users/devrafalko/followers","following_url":"https://api.github.com/users/devrafalko/following{/other_user}","gists_url":"https://api.github.com/users/devrafalko/gists{/gist_id}","starred_url":"https://api.github.com/users/devrafalko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devrafalko/subscriptions","organizations_url":"https://api.github.com/users/devrafalko/orgs","repos_url":"https://api.github.com/users/devrafalko/repos","events_url":"https://api.github.com/users/devrafalko/events{/privacy}","received_events_url":"https://api.github.com/users/devrafalko/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T14:47:29Z","updated_at":"2018-11-08T14:47:29Z","author_association":"OWNER","body":"Another way is to use `[Boolean, undefined]` as the expected type.\r\n\r\n```javascript\r\n\r\nconst typeOfArguments = require('typeof-arguments');\r\nfunction foo (str, bool=false) {\r\n  console.log(bool);\r\n  typeOfArguments(arguments, [String, [Boolean, undefined]]);\r\n}\r\n```\r\nIt expects `bool` to be `Boolean` or `undefined`.\r\nIf you pass `undefined`, the package does not throw any error and the `bool=false` default value is used.\r\nIf you pass `Boolean` value, package does not throw any error and this value is used.\r\nIf you pass any other than `Boolean` value, the package throws error."}}
{"actor":{"display_login":"devrafalko"}}