UNPKG

node-signpdf

Version:
22 lines (18 loc) 466 B
import SignPdfError from '../../SignPdfError'; /** * @param {object} refTable * @param {string} ref * @returns {number} */ const getIndexFromRef = (refTable, ref) => { let [index] = ref.split(' '); index = parseInt(index); if (!refTable.offsets.has(index)) { throw new SignPdfError( `Failed to locate object "${ref}".`, SignPdfError.TYPE_PARSE, ); } return index; }; export default getIndexFromRef;