diff --git a/lib/source-map-consumer.js b/lib/source-map-consumer.js index a7cabc86..b8d962ac 100644 --- a/lib/source-map-consumer.js +++ b/lib/source-map-consumer.js @@ -332,12 +332,13 @@ function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { var version = util.getArg(sourceMap, 'version'); var sources = util.getArg(sourceMap, 'sources'); // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + // requires the array) to play nice here. Inlined getArg with default for + // the optional fields below — see #59 for the pattern. + var names = sourceMap.names != null ? sourceMap.names : []; + var sourceRoot = sourceMap.sourceRoot != null ? sourceMap.sourceRoot : null; + var sourcesContent = sourceMap.sourcesContent != null ? sourceMap.sourcesContent : null; var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); + var file = sourceMap.file != null ? sourceMap.file : null; // Once again, Sass deviates from the spec and supplies the version as a // string rather than a number, so we use loose equality checking here.