{"action":"created","comment":{"url":"https://api.github.com/repos/medikoo/cli-color/pulls/comments/41791878","id":41791878,"diff_hunk":"@@ -0,0 +1,115 @@\n+'use strict';\n+/* CSI - control sequence introducer */\n+/* SGR - set graphic rendition */\n+\n+var assign   = require('es5-ext/object/assign')\n+  , includes = require('es5-ext/string/#/contains');\n+\n+var CSI = '\\x1b[';\n+\n+var sgr = function (code) {\n+\treturn CSI + code + 'm';\n+};\n+\n+sgr.CSI = CSI;\n+\n+var mods = assign({\n+\t// Style\n+\tbold:      { _bold: [1, 22] },\n+\titalic:    { _italic: [3, 23] },\n+\tunderline: { _underline: [4, 24] },\n+\tblink:     { _blink: [5, 25] },\n+\tinverse:   { _inverse: [7, 27] },\n+\tstrike:    { _strike: [9, 29] }\n+\n+\t// Color\n+}, ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']\n+\t.reduce(function (obj, color, index) {\n+\t\t// foreground\n+\t\tobj[color] = { _fg: [30 + index, 39] };\n+\t\tobj[color + 'Bright'] = { _fg: [90 + index, 39] };\n+\n+\t\t// background\n+\t\tobj['bg' + color[0].toUpperCase() + color.slice(1)] = { _bg: [40 + index, 49] };\n+\t\tobj['bg' + color[0].toUpperCase() + color.slice(1) + 'Bright'] = { _bg: [100 + index, 49] };\n+\n+\t\treturn obj;\n+\t}, {}));\n+\n+sgr.mods = mods;\n+\n+(function () {","path":"lib/sgr.js","position":41,"original_position":41,"commit_id":"7755078c6c1a3be2754c482e4f55bc7221d5f5ac","original_commit_id":"7755078c6c1a3be2754c482e4f55bc7221d5f5ac","user":{"login":"medikoo","id":122434,"avatar_url":"https://avatars.githubusercontent.com/u/122434?v=3","gravatar_id":"","url":"https://api.github.com/users/medikoo","html_url":"https://github.com/medikoo","followers_url":"https://api.github.com/users/medikoo/followers","following_url":"https://api.github.com/users/medikoo/following{/other_user}","gists_url":"https://api.github.com/users/medikoo/gists{/gist_id}","starred_url":"https://api.github.com/users/medikoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medikoo/subscriptions","organizations_url":"https://api.github.com/users/medikoo/orgs","repos_url":"https://api.github.com/users/medikoo/repos","events_url":"https://api.github.com/users/medikoo/events{/privacy}","received_events_url":"https://api.github.com/users/medikoo/received_events","type":"User","site_admin":false},"body":"I think there's no need to wrap it with extra closure, (what's the reason, privacy? We anyway expose most stuff on `sgr`)","created_at":"2015-10-12T19:26:26Z","updated_at":"2015-10-12T19:26:26Z","html_url":"https://github.com/medikoo/cli-color/pull/28#discussion_r41791878","pull_request_url":"https://api.github.com/repos/medikoo/cli-color/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/medikoo/cli-color/pulls/comments/41791878"},"html":{"href":"https://github.com/medikoo/cli-color/pull/28#discussion_r41791878"},"pull_request":{"href":"https://api.github.com/repos/medikoo/cli-color/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/medikoo/cli-color/pulls/28","id":44291960,"html_url":"https://github.com/medikoo/cli-color/pull/28","diff_url":"https://github.com/medikoo/cli-color/pull/28.diff","patch_url":"https://github.com/medikoo/cli-color/pull/28.patch","issue_url":"https://api.github.com/repos/medikoo/cli-color/issues/28","number":28,"state":"open","locked":false,"title":"PR: slice(styled, begin, end)","user":{"login":"StreetStrider","id":2124761,"avatar_url":"https://avatars.githubusercontent.com/u/2124761?v=3","gravatar_id":"","url":"https://api.github.com/users/StreetStrider","html_url":"https://github.com/StreetStrider","followers_url":"https://api.github.com/users/StreetStrider/followers","following_url":"https://api.github.com/users/StreetStrider/following{/other_user}","gists_url":"https://api.github.com/users/StreetStrider/gists{/gist_id}","starred_url":"https://api.github.com/users/StreetStrider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreetStrider/subscriptions","organizations_url":"https://api.github.com/users/StreetStrider/orgs","repos_url":"https://api.github.com/users/StreetStrider/repos","events_url":"https://api.github.com/users/StreetStrider/events{/privacy}","received_events_url":"https://api.github.com/users/StreetStrider/received_events","type":"User","site_admin":false},"body":"I've started to work on tests for #27. I will push commits to corresponding branch, so this PR will be live.\r\n\r\nWhat do you think about adding also `length` in support? It will calculate styled string's length. I was thinking about slicing styled strings and sometimes this will require acquiring string's length. The implementation (for now) will be simple `strip(styled).length`.","created_at":"2015-09-05T23:18:20Z","updated_at":"2015-10-12T19:26:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"debedd77fac5f7a4144d87cff7dc6c126eff2a17","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/medikoo/cli-color/pulls/28/commits","review_comments_url":"https://api.github.com/repos/medikoo/cli-color/pulls/28/comments","review_comment_url":"https://api.github.com/repos/medikoo/cli-color/pulls/comments{/number}","comments_url":"https://api.github.com/repos/medikoo/cli-color/issues/28/comments","statuses_url":"https://api.github.com/repos/medikoo/cli-color/statuses/7755078c6c1a3be2754c482e4f55bc7221d5f5ac","head":{"label":"StreetStrider:master","ref":"master","sha":"7755078c6c1a3be2754c482e4f55bc7221d5f5ac","user":{"login":"StreetStrider","id":2124761,"avatar_url":"https://avatars.githubusercontent.com/u/2124761?v=3","gravatar_id":"","url":"https://api.github.com/users/StreetStrider","html_url":"https://github.com/StreetStrider","followers_url":"https://api.github.com/users/StreetStrider/followers","following_url":"https://api.github.com/users/StreetStrider/following{/other_user}","gists_url":"https://api.github.com/users/StreetStrider/gists{/gist_id}","starred_url":"https://api.github.com/users/StreetStrider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreetStrider/subscriptions","organizations_url":"https://api.github.com/users/StreetStrider/orgs","repos_url":"https://api.github.com/users/StreetStrider/repos","events_url":"https://api.github.com/users/StreetStrider/events{/privacy}","received_events_url":"https://api.github.com/users/StreetStrider/received_events","type":"User","site_admin":false},"repo":{"id":41700802,"name":"cli-color","full_name":"StreetStrider/cli-color","owner":{"login":"StreetStrider","id":2124761,"avatar_url":"https://avatars.githubusercontent.com/u/2124761?v=3","gravatar_id":"","url":"https://api.github.com/users/StreetStrider","html_url":"https://github.com/StreetStrider","followers_url":"https://api.github.com/users/StreetStrider/followers","following_url":"https://api.github.com/users/StreetStrider/following{/other_user}","gists_url":"https://api.github.com/users/StreetStrider/gists{/gist_id}","starred_url":"https://api.github.com/users/StreetStrider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreetStrider/subscriptions","organizations_url":"https://api.github.com/users/StreetStrider/orgs","repos_url":"https://api.github.com/users/StreetStrider/repos","events_url":"https://api.github.com/users/StreetStrider/events{/privacy}","received_events_url":"https://api.github.com/users/StreetStrider/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/StreetStrider/cli-color","description":"Colors and formatting for the console","fork":true,"url":"https://api.github.com/repos/StreetStrider/cli-color","forks_url":"https://api.github.com/repos/StreetStrider/cli-color/forks","keys_url":"https://api.github.com/repos/StreetStrider/cli-color/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StreetStrider/cli-color/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StreetStrider/cli-color/teams","hooks_url":"https://api.github.com/repos/StreetStrider/cli-color/hooks","issue_events_url":"https://api.github.com/repos/StreetStrider/cli-color/issues/events{/number}","events_url":"https://api.github.com/repos/StreetStrider/cli-color/events","assignees_url":"https://api.github.com/repos/StreetStrider/cli-color/assignees{/user}","branches_url":"https://api.github.com/repos/StreetStrider/cli-color/branches{/branch}","tags_url":"https://api.github.com/repos/StreetStrider/cli-color/tags","blobs_url":"https://api.github.com/repos/StreetStrider/cli-color/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StreetStrider/cli-color/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StreetStrider/cli-color/git/refs{/sha}","trees_url":"https://api.github.com/repos/StreetStrider/cli-color/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StreetStrider/cli-color/statuses/{sha}","languages_url":"https://api.github.com/repos/StreetStrider/cli-color/languages","stargazers_url":"https://api.github.com/repos/StreetStrider/cli-color/stargazers","contributors_url":"https://api.github.com/repos/StreetStrider/cli-color/contributors","subscribers_url":"https://api.github.com/repos/StreetStrider/cli-color/subscribers","subscription_url":"https://api.github.com/repos/StreetStrider/cli-color/subscription","commits_url":"https://api.github.com/repos/StreetStrider/cli-color/commits{/sha}","git_commits_url":"https://api.github.com/repos/StreetStrider/cli-color/git/commits{/sha}","comments_url":"https://api.github.com/repos/StreetStrider/cli-color/comments{/number}","issue_comment_url":"https://api.github.com/repos/StreetStrider/cli-color/issues/comments{/number}","contents_url":"https://api.github.com/repos/StreetStrider/cli-color/contents/{+path}","compare_url":"https://api.github.com/repos/StreetStrider/cli-color/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StreetStrider/cli-color/merges","archive_url":"https://api.github.com/repos/StreetStrider/cli-color/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StreetStrider/cli-color/downloads","issues_url":"https://api.github.com/repos/StreetStrider/cli-color/issues{/number}","pulls_url":"https://api.github.com/repos/StreetStrider/cli-color/pulls{/number}","milestones_url":"https://api.github.com/repos/StreetStrider/cli-color/milestones{/number}","notifications_url":"https://api.github.com/repos/StreetStrider/cli-color/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StreetStrider/cli-color/labels{/name}","releases_url":"https://api.github.com/repos/StreetStrider/cli-color/releases{/id}","created_at":"2015-08-31T21:10:38Z","updated_at":"2015-08-31T21:10:39Z","pushed_at":"2015-10-11T14:25:12Z","git_url":"git://github.com/StreetStrider/cli-color.git","ssh_url":"git@github.com:StreetStrider/cli-color.git","clone_url":"https://github.com/StreetStrider/cli-color.git","svn_url":"https://github.com/StreetStrider/cli-color","homepage":"","size":256,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"medikoo:master","ref":"master","sha":"a4c7fcfdc1c623c753283b97f711e0bec8f2b2a2","user":{"login":"medikoo","id":122434,"avatar_url":"https://avatars.githubusercontent.com/u/122434?v=3","gravatar_id":"","url":"https://api.github.com/users/medikoo","html_url":"https://github.com/medikoo","followers_url":"https://api.github.com/users/medikoo/followers","following_url":"https://api.github.com/users/medikoo/following{/other_user}","gists_url":"https://api.github.com/users/medikoo/gists{/gist_id}","starred_url":"https://api.github.com/users/medikoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medikoo/subscriptions","organizations_url":"https://api.github.com/users/medikoo/orgs","repos_url":"https://api.github.com/users/medikoo/repos","events_url":"https://api.github.com/users/medikoo/events{/privacy}","received_events_url":"https://api.github.com/users/medikoo/received_events","type":"User","site_admin":false},"repo":{"id":2030925,"name":"cli-color","full_name":"medikoo/cli-color","owner":{"login":"medikoo","id":122434,"avatar_url":"https://avatars.githubusercontent.com/u/122434?v=3","gravatar_id":"","url":"https://api.github.com/users/medikoo","html_url":"https://github.com/medikoo","followers_url":"https://api.github.com/users/medikoo/followers","following_url":"https://api.github.com/users/medikoo/following{/other_user}","gists_url":"https://api.github.com/users/medikoo/gists{/gist_id}","starred_url":"https://api.github.com/users/medikoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medikoo/subscriptions","organizations_url":"https://api.github.com/users/medikoo/orgs","repos_url":"https://api.github.com/users/medikoo/repos","events_url":"https://api.github.com/users/medikoo/events{/privacy}","received_events_url":"https://api.github.com/users/medikoo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/medikoo/cli-color","description":"Colors and formatting for the console","fork":false,"url":"https://api.github.com/repos/medikoo/cli-color","forks_url":"https://api.github.com/repos/medikoo/cli-color/forks","keys_url":"https://api.github.com/repos/medikoo/cli-color/keys{/key_id}","collaborators_url":"https://api.github.com/repos/medikoo/cli-color/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/medikoo/cli-color/teams","hooks_url":"https://api.github.com/repos/medikoo/cli-color/hooks","issue_events_url":"https://api.github.com/repos/medikoo/cli-color/issues/events{/number}","events_url":"https://api.github.com/repos/medikoo/cli-color/events","assignees_url":"https://api.github.com/repos/medikoo/cli-color/assignees{/user}","branches_url":"https://api.github.com/repos/medikoo/cli-color/branches{/branch}","tags_url":"https://api.github.com/repos/medikoo/cli-color/tags","blobs_url":"https://api.github.com/repos/medikoo/cli-color/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/medikoo/cli-color/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/medikoo/cli-color/git/refs{/sha}","trees_url":"https://api.github.com/repos/medikoo/cli-color/git/trees{/sha}","statuses_url":"https://api.github.com/repos/medikoo/cli-color/statuses/{sha}","languages_url":"https://api.github.com/repos/medikoo/cli-color/languages","stargazers_url":"https://api.github.com/repos/medikoo/cli-color/stargazers","contributors_url":"https://api.github.com/repos/medikoo/cli-color/contributors","subscribers_url":"https://api.github.com/repos/medikoo/cli-color/subscribers","subscription_url":"https://api.github.com/repos/medikoo/cli-color/subscription","commits_url":"https://api.github.com/repos/medikoo/cli-color/commits{/sha}","git_commits_url":"https://api.github.com/repos/medikoo/cli-color/git/commits{/sha}","comments_url":"https://api.github.com/repos/medikoo/cli-color/comments{/number}","issue_comment_url":"https://api.github.com/repos/medikoo/cli-color/issues/comments{/number}","contents_url":"https://api.github.com/repos/medikoo/cli-color/contents/{+path}","compare_url":"https://api.github.com/repos/medikoo/cli-color/compare/{base}...{head}","merges_url":"https://api.github.com/repos/medikoo/cli-color/merges","archive_url":"https://api.github.com/repos/medikoo/cli-color/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/medikoo/cli-color/downloads","issues_url":"https://api.github.com/repos/medikoo/cli-color/issues{/number}","pulls_url":"https://api.github.com/repos/medikoo/cli-color/pulls{/number}","milestones_url":"https://api.github.com/repos/medikoo/cli-color/milestones{/number}","notifications_url":"https://api.github.com/repos/medikoo/cli-color/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/medikoo/cli-color/labels{/name}","releases_url":"https://api.github.com/repos/medikoo/cli-color/releases{/id}","created_at":"2011-07-11T15:05:59Z","updated_at":"2015-10-10T23:27:30Z","pushed_at":"2015-10-11T14:25:12Z","git_url":"git://github.com/medikoo/cli-color.git","ssh_url":"git@github.com:medikoo/cli-color.git","clone_url":"https://github.com/medikoo/cli-color.git","svn_url":"https://github.com/medikoo/cli-color","homepage":"","size":582,"stargazers_count":329,"watchers_count":329,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":4,"forks":15,"open_issues":4,"watchers":329,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/medikoo/cli-color/pulls/28"},"html":{"href":"https://github.com/medikoo/cli-color/pull/28"},"issue":{"href":"https://api.github.com/repos/medikoo/cli-color/issues/28"},"comments":{"href":"https://api.github.com/repos/medikoo/cli-color/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/medikoo/cli-color/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/medikoo/cli-color/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/medikoo/cli-color/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/medikoo/cli-color/statuses/7755078c6c1a3be2754c482e4f55bc7221d5f5ac"}}}}