{"action":"created","issue":{"url":"https://api.github.com/repos/josdejong/typed-function/issues/1","labels_url":"https://api.github.com/repos/josdejong/typed-function/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/josdejong/typed-function/issues/1/comments","events_url":"https://api.github.com/repos/josdejong/typed-function/issues/1/events","html_url":"https://github.com/josdejong/typed-function/issues/1","id":73784587,"number":1,"title":"Ability to perform a value conversion to a target type","user":{"login":"rjbaucells","id":1074987,"avatar_url":"https://avatars.githubusercontent.com/u/1074987?v=3","gravatar_id":"","url":"https://api.github.com/users/rjbaucells","html_url":"https://github.com/rjbaucells","followers_url":"https://api.github.com/users/rjbaucells/followers","following_url":"https://api.github.com/users/rjbaucells/following{/other_user}","gists_url":"https://api.github.com/users/rjbaucells/gists{/gist_id}","starred_url":"https://api.github.com/users/rjbaucells/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjbaucells/subscriptions","organizations_url":"https://api.github.com/users/rjbaucells/orgs","repos_url":"https://api.github.com/users/rjbaucells/repos","events_url":"https://api.github.com/users/rjbaucells/events{/privacy}","received_events_url":"https://api.github.com/users/rjbaucells/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-07T00:37:59Z","updated_at":"2015-05-07T12:54:03Z","closed_at":null,"body":"While working on some of the algorithms in [mathjs](https://github.com/josdejong/mathjs) I got to the necessity of converting a given value to a target type. This feature will allow the implementation of some performance enhancements in mathjs. The specific case is something like:\r\n\r\n- Processing a Matrix that contain values of a given type (`Complex` as an example)\r\n- Algorithm require checking that a value of the Matrix type is different than zero\r\n- A good performance enhancement will be obtaining the `equal(x,y)` signature that matches the Matrix data type (`equal(Complex, Complex)`).\r\n\r\n````\r\nvar type = 'Complex'; // Matrix datatype\r\n...\r\nvar complexEqual = equal.signatures[type + ',' + type];\r\n...\r\nvar zero = typed.convert(0, type);\r\n...\r\nif (complexEqual(value, zero)) {\r\n}\r\n````\r\n\r\nJust a feature that will be nice and will have a direct impact on mathjs.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/josdejong/typed-function/issues/comments/99854145","html_url":"https://github.com/josdejong/typed-function/issues/1#issuecomment-99854145","issue_url":"https://api.github.com/repos/josdejong/typed-function/issues/1","id":99854145,"user":{"login":"josdejong","id":568626,"avatar_url":"https://avatars.githubusercontent.com/u/568626?v=3","gravatar_id":"","url":"https://api.github.com/users/josdejong","html_url":"https://github.com/josdejong","followers_url":"https://api.github.com/users/josdejong/followers","following_url":"https://api.github.com/users/josdejong/following{/other_user}","gists_url":"https://api.github.com/users/josdejong/gists{/gist_id}","starred_url":"https://api.github.com/users/josdejong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josdejong/subscriptions","organizations_url":"https://api.github.com/users/josdejong/orgs","repos_url":"https://api.github.com/users/josdejong/repos","events_url":"https://api.github.com/users/josdejong/events{/privacy}","received_events_url":"https://api.github.com/users/josdejong/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T12:54:03Z","updated_at":"2015-05-07T12:54:03Z","body":"So you mean to expose a utility function `convert(value, type)`, that makes sense, thanks for the idea."}}