Skip to content

Commit

Permalink
Allow embedding raw text in XML writer input.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrv committed Mar 6, 2018
1 parent 98ad6f0 commit ac69266
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/writer/Writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Writer extends stream.Transform {
super({ objectMode: true });
}

transform(chunk: TokenChunk | TokenBuffer, partList: string[]) {
transform(chunk: TokenChunk | TokenBuffer | string, partList: string[]) {
const prefixList = this.prefixList;
const chunkCount = this.chunkCount++;
let buffer: TokenBuffer;
Expand All @@ -47,8 +47,11 @@ export class Writer extends stream.Transform {
let tokenNum = -1;
let namespaceList: (Namespace | undefined)[] | undefined;

if(chunk instanceof TokenChunk) {
buffer = chunk.buffer
if(typeof(chunk) == 'string') {
partList.push(chunk);
return(partList);
} else if(chunk instanceof TokenChunk) {
buffer = chunk.buffer;
namespaceList = chunk.namespaceList;
} else {
buffer = chunk;
Expand Down

0 comments on commit ac69266

Please sign in to comment.