{"action":"created","comment":{"url":"https://api.github.com/repos/enb-make/enb-source-map/pulls/comments/36079745","id":36079745,"diff_hunk":"@@ -0,0 +1,92 @@\n+var os = require('os'),\n+    expect = require('chai').expect,\n+    btoa = require('btoa'),\n+    SourceMapConsumer = require('source-map').SourceMapConsumer,\n+\n+    utils = require('../lib/utils');\n+\n+describe('Utils', function() {\n+    var SOME_SOURCE_MAP = {\n+            version: 3,\n+            file: 'min.js',\n+            names: ['bar', 'baz', 'n'],\n+            sources: ['one.js', 'two.js'],\n+            sourceRoot: 'http://example.com/www/js/',\n+            mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'\n+        },\n+        STUB_SOURCE_MAP = new SourceMapConsumer(SOME_SOURCE_MAP),\n+        SOURCE_MAP_LINE = '//# sourceMappingURL=data:application/json;base64,' + btoa(JSON.stringify(SOME_SOURCE_MAP));\n+\n+    describe('getSourceMap()', function() {\n+        it('should return source map for bunch of lines', function() {\n+            var sourceMap = utils.getSourceMap(['line1', 'line2', SOURCE_MAP_LINE]);\n+            sourceMap.should.be.deep.equal(STUB_SOURCE_MAP);\n+        });\n+\n+        it('should return source map for string content', function() {\n+            var sourceMap = utils.getSourceMap(['line1', 'line2', SOURCE_MAP_LINE].join(os.EOL));\n+            sourceMap.should.be.deep.equal(STUB_SOURCE_MAP);\n+        });\n+\n+        it('should return null if no sourcemap in lines', function() {\n+            var sourceMap = utils.getSourceMap(['line1', 'line2']);\n+            expect(sourceMap).to.be.equal(null);\n+        });\n+\n+        it('should return null if no sourcemap in content', function() {\n+            var sourceMap = utils.getSourceMap(['line1', 'line2'].join(os.EOL));\n+            expect(sourceMap).to.be.equal(null);\n+        });\n+\n+        it('should return null if sourcemap is not the last line', function() {\n+            var sourceMap = utils.getSourceMap(['line1', 'line2', SOURCE_MAP_LINE, 'some-line']);\n+            expect(sourceMap).to.be.equal(null);\n+        });\n+\n+        it('should return null if sourcemap is not the last line in content', function() {\n+            var sourceMap = utils.getSourceMap(['line1', 'line2', SOURCE_MAP_LINE, 'some-line'].join(os.EOL));\n+            expect(sourceMap).to.be.equal(null);\n+        });\n+    });\n+\n+    describe('removeBuiltInSourceMap()', function() {\n+        it('should return source map line', function() {\n+            var lines = utils.removeBuiltInSourceMap(['line1', 'line2', SOURCE_MAP_LINE]);\n+            lines.should.be.deep.equal(['line1', 'line2']);\n+        });\n+\n+        it('should return content without source map line', function() {\n+            var content = utils.removeBuiltInSourceMap(['line1', 'line2', SOURCE_MAP_LINE].join(os.EOL));\n+            content.should.be.deep.equal(['line1', 'line2'].join(os.EOL));\n+        });\n+\n+        it('should return same lines if no source map line', function() {\n+            var lines = utils.removeBuiltInSourceMap(['line1', 'line2']);\n+            lines.should.be.deep.equal(['line1', 'line2']);\n+        });\n+\n+        it('should return same content if no source map line', function() {\n+            var content = utils.removeBuiltInSourceMap(['line1', 'line2'].join(os.EOL));\n+            content.should.be.deep.equal(['line1', 'line2'].join(os.EOL));\n+        });\n+\n+        it('should return same lines if source map line is not the last one', function() {","path":"tests/utils.test.js","position":73,"original_position":73,"commit_id":"b4a771b99da41129dbdd284b145eb279dfe5f060","original_commit_id":"b4a771b99da41129dbdd284b145eb279dfe5f060","user":{"login":"blond","id":2225579,"avatar_url":"https://avatars.githubusercontent.com/u/2225579?v=3","gravatar_id":"","url":"https://api.github.com/users/blond","html_url":"https://github.com/blond","followers_url":"https://api.github.com/users/blond/followers","following_url":"https://api.github.com/users/blond/following{/other_user}","gists_url":"https://api.github.com/users/blond/gists{/gist_id}","starred_url":"https://api.github.com/users/blond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blond/subscriptions","organizations_url":"https://api.github.com/users/blond/orgs","repos_url":"https://api.github.com/users/blond/repos","events_url":"https://api.github.com/users/blond/events{/privacy}","received_events_url":"https://api.github.com/users/blond/received_events","type":"User","site_admin":false},"body":"Почему строка не соурсмапами не должна удаляться в этом случае?","created_at":"2015-08-03T12:23:53Z","updated_at":"2015-08-03T12:23:53Z","html_url":"https://github.com/enb-make/enb-source-map/pull/3#discussion_r36079745","pull_request_url":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/enb-make/enb-source-map/pulls/comments/36079745"},"html":{"href":"https://github.com/enb-make/enb-source-map/pull/3#discussion_r36079745"},"pull_request":{"href":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3","id":41276187,"html_url":"https://github.com/enb-make/enb-source-map/pull/3","diff_url":"https://github.com/enb-make/enb-source-map/pull/3.diff","patch_url":"https://github.com/enb-make/enb-source-map/pull/3.patch","issue_url":"https://api.github.com/repos/enb-make/enb-source-map/issues/3","number":3,"state":"open","locked":false,"title":"Refactoring + utils tests","user":{"login":"j0tunn","id":7701229,"avatar_url":"https://avatars.githubusercontent.com/u/7701229?v=3","gravatar_id":"","url":"https://api.github.com/users/j0tunn","html_url":"https://github.com/j0tunn","followers_url":"https://api.github.com/users/j0tunn/followers","following_url":"https://api.github.com/users/j0tunn/following{/other_user}","gists_url":"https://api.github.com/users/j0tunn/gists{/gist_id}","starred_url":"https://api.github.com/users/j0tunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0tunn/subscriptions","organizations_url":"https://api.github.com/users/j0tunn/orgs","repos_url":"https://api.github.com/users/j0tunn/repos","events_url":"https://api.github.com/users/j0tunn/events{/privacy}","received_events_url":"https://api.github.com/users/j0tunn/received_events","type":"User","site_admin":false},"body":"- добавил новый утилитарный метод:  `joinContentAndSourceMap`, вынес логику склеивания в него\r\n- поправил функцию `removeBuiltInSourceMap`, чтобы она адекватно обрабатывала ситуации, когда строка source map не последняя в тексте + теперь если на входе текст, то и на  выходе текст, а не массив строк\r\n- поправил `getSourceMap` и `removeBuiltInSourceMap` в сторону лучшей производительности - если на входе текст, то мы не разбиваем его на строки, а просто выдираем строку с source map\r\n- написал тестов на utils\r\n","created_at":"2015-07-30T20:08:04Z","updated_at":"2015-08-03T12:23:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16de207076378f9704eeffe7cd0e4419cc0a3b47","assignee":{"login":"j0tunn","id":7701229,"avatar_url":"https://avatars.githubusercontent.com/u/7701229?v=3","gravatar_id":"","url":"https://api.github.com/users/j0tunn","html_url":"https://github.com/j0tunn","followers_url":"https://api.github.com/users/j0tunn/followers","following_url":"https://api.github.com/users/j0tunn/following{/other_user}","gists_url":"https://api.github.com/users/j0tunn/gists{/gist_id}","starred_url":"https://api.github.com/users/j0tunn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j0tunn/subscriptions","organizations_url":"https://api.github.com/users/j0tunn/orgs","repos_url":"https://api.github.com/users/j0tunn/repos","events_url":"https://api.github.com/users/j0tunn/events{/privacy}","received_events_url":"https://api.github.com/users/j0tunn/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3/commits","review_comments_url":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3/comments","review_comment_url":"https://api.github.com/repos/enb-make/enb-source-map/pulls/comments{/number}","comments_url":"https://api.github.com/repos/enb-make/enb-source-map/issues/3/comments","statuses_url":"https://api.github.com/repos/enb-make/enb-source-map/statuses/b4a771b99da41129dbdd284b145eb279dfe5f060","head":{"label":"enb-make:feature/add.source.map","ref":"feature/add.source.map","sha":"b4a771b99da41129dbdd284b145eb279dfe5f060","user":{"login":"enb-make","id":4427117,"avatar_url":"https://avatars.githubusercontent.com/u/4427117?v=3","gravatar_id":"","url":"https://api.github.com/users/enb-make","html_url":"https://github.com/enb-make","followers_url":"https://api.github.com/users/enb-make/followers","following_url":"https://api.github.com/users/enb-make/following{/other_user}","gists_url":"https://api.github.com/users/enb-make/gists{/gist_id}","starred_url":"https://api.github.com/users/enb-make/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enb-make/subscriptions","organizations_url":"https://api.github.com/users/enb-make/orgs","repos_url":"https://api.github.com/users/enb-make/repos","events_url":"https://api.github.com/users/enb-make/events{/privacy}","received_events_url":"https://api.github.com/users/enb-make/received_events","type":"Organization","site_admin":false},"repo":{"id":20180511,"name":"enb-source-map","full_name":"enb-make/enb-source-map","owner":{"login":"enb-make","id":4427117,"avatar_url":"https://avatars.githubusercontent.com/u/4427117?v=3","gravatar_id":"","url":"https://api.github.com/users/enb-make","html_url":"https://github.com/enb-make","followers_url":"https://api.github.com/users/enb-make/followers","following_url":"https://api.github.com/users/enb-make/following{/other_user}","gists_url":"https://api.github.com/users/enb-make/gists{/gist_id}","starred_url":"https://api.github.com/users/enb-make/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enb-make/subscriptions","organizations_url":"https://api.github.com/users/enb-make/orgs","repos_url":"https://api.github.com/users/enb-make/repos","events_url":"https://api.github.com/users/enb-make/events{/privacy}","received_events_url":"https://api.github.com/users/enb-make/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/enb-make/enb-source-map","description":"ENB Source Maps Helper","fork":false,"url":"https://api.github.com/repos/enb-make/enb-source-map","forks_url":"https://api.github.com/repos/enb-make/enb-source-map/forks","keys_url":"https://api.github.com/repos/enb-make/enb-source-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enb-make/enb-source-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enb-make/enb-source-map/teams","hooks_url":"https://api.github.com/repos/enb-make/enb-source-map/hooks","issue_events_url":"https://api.github.com/repos/enb-make/enb-source-map/issues/events{/number}","events_url":"https://api.github.com/repos/enb-make/enb-source-map/events","assignees_url":"https://api.github.com/repos/enb-make/enb-source-map/assignees{/user}","branches_url":"https://api.github.com/repos/enb-make/enb-source-map/branches{/branch}","tags_url":"https://api.github.com/repos/enb-make/enb-source-map/tags","blobs_url":"https://api.github.com/repos/enb-make/enb-source-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enb-make/enb-source-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enb-make/enb-source-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/enb-make/enb-source-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enb-make/enb-source-map/statuses/{sha}","languages_url":"https://api.github.com/repos/enb-make/enb-source-map/languages","stargazers_url":"https://api.github.com/repos/enb-make/enb-source-map/stargazers","contributors_url":"https://api.github.com/repos/enb-make/enb-source-map/contributors","subscribers_url":"https://api.github.com/repos/enb-make/enb-source-map/subscribers","subscription_url":"https://api.github.com/repos/enb-make/enb-source-map/subscription","commits_url":"https://api.github.com/repos/enb-make/enb-source-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/enb-make/enb-source-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/enb-make/enb-source-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/enb-make/enb-source-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/enb-make/enb-source-map/contents/{+path}","compare_url":"https://api.github.com/repos/enb-make/enb-source-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enb-make/enb-source-map/merges","archive_url":"https://api.github.com/repos/enb-make/enb-source-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enb-make/enb-source-map/downloads","issues_url":"https://api.github.com/repos/enb-make/enb-source-map/issues{/number}","pulls_url":"https://api.github.com/repos/enb-make/enb-source-map/pulls{/number}","milestones_url":"https://api.github.com/repos/enb-make/enb-source-map/milestones{/number}","notifications_url":"https://api.github.com/repos/enb-make/enb-source-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enb-make/enb-source-map/labels{/name}","releases_url":"https://api.github.com/repos/enb-make/enb-source-map/releases{/id}","created_at":"2014-05-26T09:08:28Z","updated_at":"2015-07-30T17:03:00Z","pushed_at":"2015-08-03T08:47:07Z","git_url":"git://github.com/enb-make/enb-source-map.git","ssh_url":"git@github.com:enb-make/enb-source-map.git","clone_url":"https://github.com/enb-make/enb-source-map.git","svn_url":"https://github.com/enb-make/enb-source-map","homepage":"","size":172,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":8,"default_branch":"master"}},"base":{"label":"enb-make:master","ref":"master","sha":"a30be58734e5d7dbdb1fe6760ada8d95c2ebee0d","user":{"login":"enb-make","id":4427117,"avatar_url":"https://avatars.githubusercontent.com/u/4427117?v=3","gravatar_id":"","url":"https://api.github.com/users/enb-make","html_url":"https://github.com/enb-make","followers_url":"https://api.github.com/users/enb-make/followers","following_url":"https://api.github.com/users/enb-make/following{/other_user}","gists_url":"https://api.github.com/users/enb-make/gists{/gist_id}","starred_url":"https://api.github.com/users/enb-make/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enb-make/subscriptions","organizations_url":"https://api.github.com/users/enb-make/orgs","repos_url":"https://api.github.com/users/enb-make/repos","events_url":"https://api.github.com/users/enb-make/events{/privacy}","received_events_url":"https://api.github.com/users/enb-make/received_events","type":"Organization","site_admin":false},"repo":{"id":20180511,"name":"enb-source-map","full_name":"enb-make/enb-source-map","owner":{"login":"enb-make","id":4427117,"avatar_url":"https://avatars.githubusercontent.com/u/4427117?v=3","gravatar_id":"","url":"https://api.github.com/users/enb-make","html_url":"https://github.com/enb-make","followers_url":"https://api.github.com/users/enb-make/followers","following_url":"https://api.github.com/users/enb-make/following{/other_user}","gists_url":"https://api.github.com/users/enb-make/gists{/gist_id}","starred_url":"https://api.github.com/users/enb-make/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enb-make/subscriptions","organizations_url":"https://api.github.com/users/enb-make/orgs","repos_url":"https://api.github.com/users/enb-make/repos","events_url":"https://api.github.com/users/enb-make/events{/privacy}","received_events_url":"https://api.github.com/users/enb-make/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/enb-make/enb-source-map","description":"ENB Source Maps Helper","fork":false,"url":"https://api.github.com/repos/enb-make/enb-source-map","forks_url":"https://api.github.com/repos/enb-make/enb-source-map/forks","keys_url":"https://api.github.com/repos/enb-make/enb-source-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/enb-make/enb-source-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/enb-make/enb-source-map/teams","hooks_url":"https://api.github.com/repos/enb-make/enb-source-map/hooks","issue_events_url":"https://api.github.com/repos/enb-make/enb-source-map/issues/events{/number}","events_url":"https://api.github.com/repos/enb-make/enb-source-map/events","assignees_url":"https://api.github.com/repos/enb-make/enb-source-map/assignees{/user}","branches_url":"https://api.github.com/repos/enb-make/enb-source-map/branches{/branch}","tags_url":"https://api.github.com/repos/enb-make/enb-source-map/tags","blobs_url":"https://api.github.com/repos/enb-make/enb-source-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/enb-make/enb-source-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/enb-make/enb-source-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/enb-make/enb-source-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/enb-make/enb-source-map/statuses/{sha}","languages_url":"https://api.github.com/repos/enb-make/enb-source-map/languages","stargazers_url":"https://api.github.com/repos/enb-make/enb-source-map/stargazers","contributors_url":"https://api.github.com/repos/enb-make/enb-source-map/contributors","subscribers_url":"https://api.github.com/repos/enb-make/enb-source-map/subscribers","subscription_url":"https://api.github.com/repos/enb-make/enb-source-map/subscription","commits_url":"https://api.github.com/repos/enb-make/enb-source-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/enb-make/enb-source-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/enb-make/enb-source-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/enb-make/enb-source-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/enb-make/enb-source-map/contents/{+path}","compare_url":"https://api.github.com/repos/enb-make/enb-source-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/enb-make/enb-source-map/merges","archive_url":"https://api.github.com/repos/enb-make/enb-source-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/enb-make/enb-source-map/downloads","issues_url":"https://api.github.com/repos/enb-make/enb-source-map/issues{/number}","pulls_url":"https://api.github.com/repos/enb-make/enb-source-map/pulls{/number}","milestones_url":"https://api.github.com/repos/enb-make/enb-source-map/milestones{/number}","notifications_url":"https://api.github.com/repos/enb-make/enb-source-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/enb-make/enb-source-map/labels{/name}","releases_url":"https://api.github.com/repos/enb-make/enb-source-map/releases{/id}","created_at":"2014-05-26T09:08:28Z","updated_at":"2015-07-30T17:03:00Z","pushed_at":"2015-08-03T08:47:07Z","git_url":"git://github.com/enb-make/enb-source-map.git","ssh_url":"git@github.com:enb-make/enb-source-map.git","clone_url":"https://github.com/enb-make/enb-source-map.git","svn_url":"https://github.com/enb-make/enb-source-map","homepage":"","size":172,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3"},"html":{"href":"https://github.com/enb-make/enb-source-map/pull/3"},"issue":{"href":"https://api.github.com/repos/enb-make/enb-source-map/issues/3"},"comments":{"href":"https://api.github.com/repos/enb-make/enb-source-map/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/enb-make/enb-source-map/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/enb-make/enb-source-map/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/enb-make/enb-source-map/statuses/b4a771b99da41129dbdd284b145eb279dfe5f060"}}}}