From d46b09ac32143e1b958af693afffe958082a12b4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 25 Sep 2017 11:22:39 +0200 Subject: [PATCH] add decode fn --- src/util/sourceMappingDecoder.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/util/sourceMappingDecoder.js b/src/util/sourceMappingDecoder.js index 39ea602a7a..eb1154499d 100644 --- a/src/util/sourceMappingDecoder.js +++ b/src/util/sourceMappingDecoder.js @@ -18,6 +18,23 @@ function SourceMappingDecoder () { */ SourceMappingDecoder.prototype.atIndex = atIndex +/** + * Decode the given @arg value + * + * @param {string} value - source location to decode ( should be start:length:file ) + * @return {Object} returns the decompressed source mapping {start, length, file} + */ +SourceMappingDecoder.prototype.decode = function (value) { + if (value) { + value = value.split(':') + return { + start: parseInt(value[0]), + length: parseInt(value[1]), + file: parseInt(value[2]) + } + } +} + /** * Decode the source mapping for the given compressed mapping *