{"action":"created","issue":{"url":"https://api.github.com/repos/stylus/stylus/issues/2079","labels_url":"https://api.github.com/repos/stylus/stylus/issues/2079/labels{/name}","comments_url":"https://api.github.com/repos/stylus/stylus/issues/2079/comments","events_url":"https://api.github.com/repos/stylus/stylus/issues/2079/events","html_url":"https://github.com/stylus/stylus/pull/2079","id":124558639,"number":2079,"title":"Add percentage function to built in functions","user":{"login":"iDev0urer","id":4535422,"avatar_url":"https://avatars.githubusercontent.com/u/4535422?v=3","gravatar_id":"","url":"https://api.github.com/users/iDev0urer","html_url":"https://github.com/iDev0urer","followers_url":"https://api.github.com/users/iDev0urer/followers","following_url":"https://api.github.com/users/iDev0urer/following{/other_user}","gists_url":"https://api.github.com/users/iDev0urer/gists{/gist_id}","starred_url":"https://api.github.com/users/iDev0urer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDev0urer/subscriptions","organizations_url":"https://api.github.com/users/iDev0urer/orgs","repos_url":"https://api.github.com/users/iDev0urer/repos","events_url":"https://api.github.com/users/iDev0urer/events{/privacy}","received_events_url":"https://api.github.com/users/iDev0urer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-01T19:44:46Z","updated_at":"2016-01-03T23:50:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/stylus/stylus/pulls/2079","html_url":"https://github.com/stylus/stylus/pull/2079","diff_url":"https://github.com/stylus/stylus/pull/2079.diff","patch_url":"https://github.com/stylus/stylus/pull/2079.patch"},"body":"The percentage function will simply turn a given number into a percent. SASS has a similar function. I wrote tests for it which are passing."},"comment":{"url":"https://api.github.com/repos/stylus/stylus/issues/comments/168556074","html_url":"https://github.com/stylus/stylus/pull/2079#issuecomment-168556074","issue_url":"https://api.github.com/repos/stylus/stylus/issues/2079","id":168556074,"user":{"login":"kizu","id":177485,"avatar_url":"https://avatars.githubusercontent.com/u/177485?v=3","gravatar_id":"","url":"https://api.github.com/users/kizu","html_url":"https://github.com/kizu","followers_url":"https://api.github.com/users/kizu/followers","following_url":"https://api.github.com/users/kizu/following{/other_user}","gists_url":"https://api.github.com/users/kizu/gists{/gist_id}","starred_url":"https://api.github.com/users/kizu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kizu/subscriptions","organizations_url":"https://api.github.com/users/kizu/orgs","repos_url":"https://api.github.com/users/kizu/repos","events_url":"https://api.github.com/users/kizu/events{/privacy}","received_events_url":"https://api.github.com/users/kizu/received_events","type":"User","site_admin":false},"created_at":"2016-01-03T23:50:53Z","updated_at":"2016-01-03T23:50:53Z","body":"Seems fine! It would be nice to allow this function to handle more cases:\r\n\r\n1. `percentage(1 / 100px)` — when there is already a unit inside, the result won't make much sense. This can be fixed by changing the `+ '%'` with `unit(num * 100, '%')`.\r\n\r\n2. When the result is already in percents, the function shouldn't do anything: `percentage(40%)` should return just `40%`.\r\n\r\nIf you'd like, you can intruduce those changes to this function in this PR, or we'll do it by ourselves when the time would come for the next release."}}