pdf-lib
Version:
Library for creating and modifying PDF files in JavaScript
40 lines (39 loc) • 1.82 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
}
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../../utils");
var validate_1 = require("../../utils/validate");
var PDFObject_1 = __importDefault(require("./PDFObject"));
// const PDF_NULL_ENFORCER = Symbol('PDF_NULL_ENFORCER');
// Using a Symbol is ideal here, but React Native doesn't current support them,
// so we'll use a string instead.
var PDF_NULL_ENFORCER = '@@__PDF_NULL_ENFORCER';
var PDFNull = /** @class */ (function (_super) {
__extends(PDFNull, _super);
function PDFNull(enforcer) {
var _this = _super.call(this) || this;
_this.clone = function () { return _this; };
_this.toString = function () { return 'null'; };
_this.bytesSize = function () { return 4; };
_this.copyBytesInto = function (buffer) {
return utils_1.addStringToBuffer('null', buffer);
};
validate_1.validate(enforcer, validate_1.isIdentity(PDF_NULL_ENFORCER), 'Cannot create new PDFNull objects - use PDFNull.instance');
return _this;
}
PDFNull.instance = new PDFNull(PDF_NULL_ENFORCER);
return PDFNull;
}(PDFObject_1.default));
exports.default = PDFNull;
;