mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 22:25:24 +00:00
FieldsArray: merged assertUnfrozen check with registerWithValidation in splice
This commit is contained in:
@@ -39,13 +39,13 @@ export default class FieldsArray extends Array<Schemas.Field> {
|
|||||||
deleteCount: number,
|
deleteCount: number,
|
||||||
...items: Schemas.Field[]
|
...items: Schemas.Field[]
|
||||||
): Schemas.Field[] {
|
): Schemas.Field[] {
|
||||||
Utils.assertUnfrozen(this[passInstanceSymbol]);
|
// Perfoming frozen check, validation and getting valid items
|
||||||
|
const validItems = registerWithValidation(this, ...items);
|
||||||
|
|
||||||
for (let i = start; i < start + deleteCount; i++) {
|
for (let i = start; i < start + deleteCount; i++) {
|
||||||
this[sharedKeysPoolSymbol].delete(this[i].key);
|
this[sharedKeysPoolSymbol].delete(this[i].key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const validItems = registerWithValidation(this, ...items);
|
|
||||||
return super.splice(start, deleteCount, ...validItems);
|
return super.splice(start, deleteCount, ...validItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user