function stripComments(text, replaceCh) {
        var _scanner = scanner_1.createScanner(text), parts = [], kind, offset = 0, pos;
        do {
            pos = _scanner.getPosition();
            kind = _scanner.scan();
            switch (kind) {
                case 12 /* LineCommentTrivia */:
                case 13 /* BlockCommentTrivia */:
                case 17 /* EOF */:
                    if (offset !== pos) {
                        parts.push(text.substring(offset, pos));
                    }
                    if (replaceCh !== void 0) {
                        parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));
                    }
                    offset = _scanner.getPosition();
                    break;
            }
        } while (kind !== 17 /* EOF */);
        return parts.join('');
    }
/**
     * Takes JSON with JavaScript-style comments and remove
     * them. Optionally replaces every none-newline character
     * of comments with a replaceCharacter
     */
Takes JSON with JavaScript-style comments and remove
them. Optionally replaces every none-newline character
of comments with a replaceCharacter
Takes JSON with JavaScript - style comments and remove them . Optionally replaces every none - newline character of comments with a replaceCharacter
function stripComments(text, replaceCh) {
        var _scanner = scanner_1.createScanner(text), parts = [], kind, offset = 0, pos;
        do {
            pos = _scanner.getPosition();
            kind = _scanner.scan();
            switch (kind) {
                case 12 :
                case 13 :
                case 17 :
                    if (offset !== pos) {
                        parts.push(text.substring(offset, pos));
                    }
                    if (replaceCh !== void 0) {
                        parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));
                    }
                    offset = _scanner.getPosition();
                    break;
            }
        } while (kind !== 17 );
        return parts.join('');
    }
function stripComments ( text , replaceCh ) { var _scanner = scanner_1 . createScanner ( text ) , parts = [ ] , kind , offset = 0 , pos ; do { pos = _scanner . getPosition ( ) ; kind = _scanner . scan ( ) ; switch ( kind ) { case 12 : case 13 : case 17 : if ( offset !== pos ) { parts . push ( text . substring ( offset , pos ) ) ; } if ( replaceCh !== void 0 ) { parts . push ( _scanner . getTokenValue ( ) . replace ( / [^\r\n] / g , replaceCh ) ) ; } offset = _scanner . getPosition ( ) ; break ; } } while ( kind !== 17 ) ; return parts . join ( '' ) ; }
Takes JSON with JavaScript-style comments and remove
 them.
Takes JSON with JavaScript - style comments and remove them .
/* LineCommentTrivia */ /* BlockCommentTrivia */ /* EOF */ /* EOF */