Changed implementation of FieldsArray to accept passInstance instead of pool, to check frozen instance

This commit is contained in:
Alexander Cerutti
2021-10-22 22:37:51 +02:00
parent e0c6d61c30
commit 3b69446873
3 changed files with 38 additions and 13 deletions

View File

@@ -1,3 +1,6 @@
import * as Messages from "./messages";
import type Bundle from "./Bundle";
/**
* Acts as a wrapper for converting date to W3C string
* @param date
@@ -105,3 +108,9 @@ export function cloneRecursive(object: Object) {
return objectCopy;
}
export function assertUnfrozen(instance: InstanceType<typeof Bundle>) {
if (instance.isFrozen) {
throw new Error(Messages.BUNDLE.CLOSED);
}
}