UNPKG

xcom2charpool

Version:

Library for reading, manipulating, and managing XCOM 2 character pool binary files, supporting both browser and Node.js environments.

48 lines (47 loc) 2.28 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var _NamePropertyValue_instanceId; Object.defineProperty(exports, "__esModule", { value: true }); exports.NamePropertyValue = void 0; /** * Value object for UE NameProperty including the instance id suffix. */ class NamePropertyValue { constructor(value, instanceId) { this.value = value; _NamePropertyValue_instanceId.set(this, 0); this.instanceId = instanceId; } get instanceId() { return __classPrivateFieldGet(this, _NamePropertyValue_instanceId, "f"); } set instanceId(value) { if (!Number.isInteger(value) || value < 0) { throw new Error('NamePropertyValue instanceId must be a positive integer'); } if (value > 0xffffffff) { throw new Error('NamePropertyValue instanceId cannot exceed 0xFFFFFFFF'); } __classPrivateFieldSet(this, _NamePropertyValue_instanceId, value, "f"); } toString() { if (this.instanceId > 0) { return `${this.value}_${this.instanceId - 1}`; } else { return this.value; } } } exports.NamePropertyValue = NamePropertyValue; _NamePropertyValue_instanceId = new WeakMap();