[Pkg-javascript-commits] [node-parse-base64vlq-mappings] 15/26: don't add "original: { }" when mapping has no original
Bastien Roucariès
rouca at moszumanska.debian.org
Mon Sep 18 09:24:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-parse-base64vlq-mappings.
commit 597c5c68a26a794edeab73af29a0548dafd080b7
Author: Tomi Belan <tomi.belan at gmail.com>
Date: Wed Mar 27 12:01:43 2013 +0100
don't add "original: { }" when mapping has no original
---
index.js | 3 ++-
test/parse-base64vlq-mappings.js | 10 ++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/index.js b/index.js
index da5782b..69d4ae0 100644
--- a/index.js
+++ b/index.js
@@ -29,7 +29,7 @@ module.exports = function parse(str_) {
str = str.slice(1);
}
else {
- mapping = { generated: { }, original: { } };
+ mapping = { generated: { } };
mapping.generated.line = generatedLine;
// Generated column.
@@ -49,6 +49,7 @@ module.exports = function parse(str_) {
// Original line.
temp = base64VLQ.decode(str);
+ mapping.original = { };
mapping.original.line = previousOriginalLine + temp.value;
previousOriginalLine = mapping.original.line;
// Lines are stored 0-based
diff --git a/test/parse-base64vlq-mappings.js b/test/parse-base64vlq-mappings.js
index a3f4f7e..ab4d59e 100644
--- a/test/parse-base64vlq-mappings.js
+++ b/test/parse-base64vlq-mappings.js
@@ -28,10 +28,11 @@ test('parsing generated one to one mappings', function (t) {
{ generated: { line: 5, column: 0 },
original: { line: 5, column: 0 },
source: 'foo.js',
- name: null } ]
+ name: null },
+ { generated: { line: 6, column: 0 } } ]
add.forEach(gen.addMapping.bind(gen))
- var addedMappings = add.map(function (m) { return { generated: m.generated, original: m.original } })
+ var addedMappings = add.map(function (m) { return m.original ? { generated: m.generated, original: m.original } : { generated: m.generated } })
var mappings = gen.toJSON().mappings
, parsed = parse(mappings)
@@ -57,10 +58,11 @@ test('parsing generated offset mappings', function (t) {
{ generated: { line: 24, column: 0 },
original: { line: 4, column: 5 },
source: 'foo.js',
- name: null }]
+ name: null },
+ { generated: { line: 25, column: 0 } } ]
add.forEach(gen.addMapping.bind(gen))
- var addedMappings = add.map(function (m) { return { generated: m.generated, original: m.original } })
+ var addedMappings = add.map(function (m) { return m.original ? { generated: m.generated, original: m.original } : { generated: m.generated } })
var mappings = gen.toJSON().mappings
, parsed = parse(mappings)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-parse-base64vlq-mappings.git
More information about the Pkg-javascript-commits
mailing list