All files / src/emitter string.js

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  21x 21x 21x             389x 389x 3179x   389x    
// @flow
import { u8 } from 'wasm-types';
import { varuint32 } from './numbers';
import OutputStream from '../utils/output-stream';
 
export function emitString(
  stream: OutputStream,
  string: string,
  debug: string
) {
  stream.push(varuint32, string.length, debug);
  for (let i = 0; i < string.length; i++) {
    stream.push(u8, string.charCodeAt(i), string[i]);
  }
  return stream;
}