{"action":"created","issue":{"url":"https://api.github.com/repos/josdejong/mathjs/issues/683","repository_url":"https://api.github.com/repos/josdejong/mathjs","labels_url":"https://api.github.com/repos/josdejong/mathjs/issues/683/labels{/name}","comments_url":"https://api.github.com/repos/josdejong/mathjs/issues/683/comments","events_url":"https://api.github.com/repos/josdejong/mathjs/issues/683/events","html_url":"https://github.com/josdejong/mathjs/pull/683","id":165460825,"number":683,"title":"Create user-defined units","user":{"login":"ericman314","id":6345617,"avatar_url":"https://avatars.githubusercontent.com/u/6345617?v=3","gravatar_id":"","url":"https://api.github.com/users/ericman314","html_url":"https://github.com/ericman314","followers_url":"https://api.github.com/users/ericman314/followers","following_url":"https://api.github.com/users/ericman314/following{/other_user}","gists_url":"https://api.github.com/users/ericman314/gists{/gist_id}","starred_url":"https://api.github.com/users/ericman314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericman314/subscriptions","organizations_url":"https://api.github.com/users/ericman314/orgs","repos_url":"https://api.github.com/users/ericman314/repos","events_url":"https://api.github.com/users/ericman314/events{/privacy}","received_events_url":"https://api.github.com/users/ericman314/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-07-14T02:08:41Z","updated_at":"2016-09-29T09:21:15Z","closed_at":"2016-07-28T19:05:44Z","pull_request":{"url":"https://api.github.com/repos/josdejong/mathjs/pulls/683","html_url":"https://github.com/josdejong/mathjs/pull/683","diff_url":"https://github.com/josdejong/mathjs/pull/683.diff","patch_url":"https://github.com/josdejong/mathjs/pull/683.patch"},"body":"Create a user-defined unit. The user supplies the name of the new unit, the definition in terms of existing units, and options such as prefixes and aliases.\r\n\r\n```js\r\nmath.createUnit('knot', '0.514444 m/s', {aliases: ['knots', 'kts', 'kt']})  // knot\r\nmath.eval('4 week to createUnit(\"fortnight\", 14 days)')  // 2 fortnight\r\n```\r\n\r\nTODO:\r\n\r\nUnits are installed directly in the global `math.type.Unit` scope, so you can't use different sets of user-defined units in multiple scopes at the same time like you can with user-defined variables. Supporting this might be time consuming and not very much worth it.\r\n\r\nCurrently the only validation done on names of new units is to check for collisions with other units. We might want to add checks for collisions with built-in functions, and to check for valid characters (like not allowing `%` as a unit name).\r\n\r\nWhen we are satisfied with the API I will also update the docs.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/josdejong/mathjs/issues/comments/250414712","html_url":"https://github.com/josdejong/mathjs/pull/683#issuecomment-250414712","issue_url":"https://api.github.com/repos/josdejong/mathjs/issues/683","id":250414712,"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":"2016-09-29T09:21:15Z","updated_at":"2016-09-29T09:21:15Z","body":"Good to hear :)"}}
{"actor":{"display_login":"josdejong"}}