UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

43 lines 1.22 kB
import { IfdValue } from './ifd-value.js'; import { IfdValueType } from '../ifd-value-type.js'; import { ArrayUtils } from '../../common/array-utils.js'; export class IfdUndefinedValue extends IfdValue { get type() { return IfdValueType.undefined; } get length() { return this._value.length; } constructor(value) { super(); if (typeof value === 'number') { this._value = new Uint8Array(1); this._value[0] = value; } else { this._value = value; } } static data(data, offset, length) { const array = new Uint8Array(data.toUint8Array(offset, length)); return new IfdUndefinedValue(array); } toData() { return this._value; } write(out) { out.writeBytes(this._value); } equals(other) { return (other instanceof IfdUndefinedValue && this.length === other.length && ArrayUtils.equals(this._value, other._value)); } clone() { return new IfdUndefinedValue(this._value); } toString() { return `${this.constructor.name} (undefined)`; } } //# sourceMappingURL=ifd-undefined-value.js.map