[Pkg-javascript-commits] [node-convert-source-map] 01/07: Imported Upstream version 1.1.2

Ross Gammon ross-guest at moszumanska.debian.org
Fri Nov 20 20:14:54 UTC 2015


This is an automated email from the git hooks/post-receive script.

ross-guest pushed a commit to branch master
in repository node-convert-source-map.

commit f2486cae9714d4fcf57251f31c680747cfbcc08f
Author: Ross Gammon <rossgammon at mail.dk>
Date:   Fri Nov 20 20:33:40 2015 +0100

    Imported Upstream version 1.1.2
---
 index.js                   |  9 ++++++---
 package.json               |  2 +-
 test/convert-source-map.js | 12 ++++++++++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/index.js b/index.js
index c340dde..fbe9201 100644
--- a/index.js
+++ b/index.js
@@ -20,7 +20,7 @@ function readFromFileMap(sm, dir) {
 
   var r = mapFileCommentRx.exec(sm);
   mapFileCommentRx.lastIndex = 0;
-  
+
   // for some odd reason //# .. captures in 1 and /* .. */ in 2
   var filename = r[1] || r[2];
   var filepath = path.join(dir, filename);
@@ -46,7 +46,7 @@ function Converter (sm, opts) {
 function convertFromLargeSource(content){
   var lines = content.split('\n');
   var line;
-  // find first line which contains a source map starting at end of content 
+  // find first line which contains a source map starting at end of content
   for (var i = lines.length - 1; i > 0; i--) {
     line = lines[i]
     if (~line.indexOf('sourceMappingURL=data:')) return exports.fromComment(line);
@@ -113,7 +113,10 @@ exports.fromMapFileComment = function (comment, dir) {
 
 // Finds last sourcemap comment in file or returns null if none was found
 exports.fromSource = function (content, largeSource) {
-  if (largeSource) return convertFromLargeSource(content);
+  if (largeSource) {
+    var res = convertFromLargeSource(content);
+    return res ? res : null;
+  }
 
   var m = content.match(commentRx);
   commentRx.lastIndex = 0;
diff --git a/package.json b/package.json
index c9e3367..b058d95 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "convert-source-map",
-  "version": "1.1.1",
+  "version": "1.1.2",
   "description": "Converts a source-map from/to  different formats and allows adding/changing properties.",
   "main": "index.js",
   "scripts": {
diff --git a/test/convert-source-map.js b/test/convert-source-map.js
index 5263d1f..9bd3ba9 100644
--- a/test/convert-source-map.js
+++ b/test/convert-source-map.js
@@ -193,3 +193,15 @@ test('getting properties', function (t) {
   t.deepEqual(sm.getProperty('sources'), ['foo.js', 'bar.js'], 'gets sources')
   t.end()
 })
+
+test('return null fromSource when largeSource is true', function(t) {
+  var mod = convert.fromSource('', true)
+    , expected = null;
+
+  t.equal(
+      mod
+    , expected
+    , 'return value should be null'
+  )
+  t.end()
+})

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-convert-source-map.git



More information about the Pkg-javascript-commits mailing list