Skip to content
This repository was archived by the owner on Dec 3, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sourcemap-codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export function decode(mappings: string): SourceMapMappings {
const c = mappings.charCodeAt(i);

if (c === 44) { // ","
if (segment.length) line.push(new Int32Array(segment) as any);
if (segment.length) line.push(segment as SourceMapSegment);
segment = [];
j = 0;

} else if (c === 59) { // ";"
if (segment.length) line.push(new Int32Array(segment) as any);
if (segment.length) line.push(segment as SourceMapSegment);
segment = [];
j = 0;
decoded.push(line);
Expand Down Expand Up @@ -88,7 +88,7 @@ export function decode(mappings: string): SourceMapMappings {
}
}

if (segment.length) line.push(new Int32Array(segment) as any);
if (segment.length) line.push(segment as SourceMapSegment);
decoded.push(line);

return decoded;
Expand Down
5 changes: 1 addition & 4 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ describe('sourcemap-codec', () => {
describe('decode()', () => {
tests.forEach((test, i) => {
it('decodes sample ' + i, () => {
const expected = test.decoded.map(line => {
return line.map(segment => new Int32Array(segment));
});
assert.deepEqual(decode(test.encoded), expected);
assert.deepEqual(decode(test.encoded), test.decoded);
});
});
});
Expand Down