Skip to content

Commit 1adeea1

Browse files
committed
Merge pull request #1 from oddbird/master
Do not output "undefined" if more mappings than lines.
2 parents d657806 + 84ef8e8 commit 1adeea1

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

lib/fromStringWithSourceMap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = function fromStringWithSourceMap(code, map) {
1919
var currentSourceNodeLine;
2020
mappings.forEach(function(mapping, idx) {
2121
var line = lines[idx];
22+
if(typeof line === 'undefined') return;
2223
if(idx !== lines.length - 1) line += "\n";
2324
if(!mapping)
2425
return addCode(line);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 3,
3+
"file": "mismatched-mappings.generated.txt",
4+
"sources": [
5+
"hello-world.txt"
6+
],
7+
"sourcesContent": [
8+
"function foobar() {\n return; // foo\n}"
9+
],
10+
"mappings": "AAAA;AACA;AADA"
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function foobar() {
2+
return; // foo
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 3,
3+
"file": "mismatched-mappings.generated.txt",
4+
"sources": [
5+
"hello-world.txt"
6+
],
7+
"sourcesContent": [
8+
"function foobar() {\n return; // foo\n}"
9+
],
10+
"mappings": "AAAA,SAAS,MAAT,GAAmB;AACjB;CADF;AAAmB"
11+
}

0 commit comments

Comments
 (0)