isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
21 lines (20 loc) • 877 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSerializationBrand = isSerializationBrand;
const cachedEnumValues_1 = require("./cachedEnumValues");
const types_1 = require("./functions/types");
const ReadonlySet_1 = require("./types/ReadonlySet");
const SERIALIZATION_BRAND_SET = new ReadonlySet_1.ReadonlySet(cachedEnumValues_1.SERIALIZATION_BRAND_VALUES);
/**
* Helper function to check if a key of a table in the "save#.dat" file is a serialization brand
* inserted by the save data manager (i.e. the `deepCopy` function).
*
* This is separated from the other serialization functions because end-users would not normally be
* iterating through a serialized object directly.
*/
function isSerializationBrand(key) {
if (!(0, types_1.isString)(key)) {
return false;
}
return SERIALIZATION_BRAND_SET.has(key);
}