fixes issue #621 SourceMap toString JSON format
authorBryce Cronkite-Ratcliff <brycecr@Bryces-MacBook-Pro.local>
Sat, 24 Jan 2015 08:24:08 +0000 (00:24 -0800)
committerBryce Cronkite-Ratcliff <brycecr@Bryces-MacBook-Pro.local>
Sat, 24 Jan 2015 08:33:02 +0000 (00:33 -0800)
The correct format of a sourcemap is acquired
from a mozilla source map generator by calling
toJSON on this object. This patch alters the
toString function on mozilla generators to print
the format that is to spec instead of the generator's
internal representation of itself.

lib/sourcemap.js

index 3998e40..a67011f 100644 (file)
@@ -87,6 +87,6 @@ function SourceMap(options) {
     return {
         add        : add,
         get        : function() { return generator },
-        toString   : function() { return generator.toString() }
+        toString   : function() { return JSON.stringify(generator.toJSON()); }
     };
 };