UNPKG

rtf-stream-parser

Version:

Stream Transform class to tokenize RTF, and another to de-encapsulate text or HTML

22 lines (21 loc) 771 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkVersion = void 0; exports.checkVersion = { allTokenHandler: (global, token) => { if (global._count === 1 && token.type !== 0) { throw new Error('File should start with "{"'); } if (global._count === 2 && (token.word !== 'rtf' || (token.param && token.param !== 1))) { throw new Error('File should start with "{\\rtf[0,1]"'); } }, preStreamFlushHandler: global => { if (global._count === 0) { throw new Error('File should start with "{"'); } else if (global._count === 1) { throw new Error('File should start with "{\\rtf"'); } } };