mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-24 00:22:34 +02:00
initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import SignPdfError from './SignPdfError.js';
|
||||
|
||||
/**
|
||||
* @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;
|
||||
Reference in New Issue
Block a user