lib/record-patch-builder.js
function resolvePropPointer(recordTypeDesc, propPointer, noDash, ptrUse) {

	// parse the pointer
	const ptr = pointers.parse(recordTypeDesc, propPointer, noDash);

	// check if top pointer
	if (ptr.isRoot())
		throw new common.X2SyntaxError(
			'Patch operations involving top records as a whole are not' +
				' allowed.');

	// check the use
	if (ptrUse === PTRUSE.SET) {
		if (!ptr.propDesc.modifiable)
			throw new common.X2SyntaxError(
				`May not update non-modifiable property ${ptr.propPath}.`);
	} else if (ptrUse === PTRUSE.ERASE) {
		if ((ptr.propDesc.isScalar() || !ptr.collectionElement) &&
			!ptr.propDesc.optional)
			throw new common.X2SyntaxError(
				`May not remove a required property ${ptr.propPath}.`);
	}

	// return the resolved pointer
	return ptr;
}
function resolvePropPointer(recordTypeDesc, propPointer, noDash, ptrUse) {

	// parse the pointer
	const ptr = pointers.parse(recordTypeDesc, propPointer, noDash);

	// check if top pointer
	if (ptr.isRoot())
		throw new common.X2SyntaxError(
			'Patch operations involving top records as a whole are not' +
				' allowed.');

	// check the use
	if (ptrUse === PTRUSE.SET) {
		if (!ptr.propDesc.modifiable)
			throw new common.X2SyntaxError(
				`May not update non-modifiable property ${ptr.propPath}.`);
	} else if (ptrUse === PTRUSE.ERASE) {
		if ((ptr.propDesc.isScalar() || !ptr.collectionElement) &&
			!ptr.propDesc.optional)
			throw new common.X2SyntaxError(
				`May not remove a required property ${ptr.propPath}.`);
	}

	// return the resolved pointer
	return ptr;
}
function resolvePropPointer ( recordTypeDesc , propPointer , noDash , ptrUse ) { // parse the pointer const ptr = pointers . parse ( recordTypeDesc , propPointer , noDash ) ; // check if top pointer if ( ptr . isRoot ( ) ) throw new common . X2SyntaxError ( 'Patch operations involving top records as a whole are not' + ' allowed.' ) ; // check the use if ( ptrUse === PTRUSE . SET ) { if ( ! ptr . propDesc . modifiable ) throw new common . X2SyntaxError ( ` ${ ptr . propPath } ` ) ; } else if ( ptrUse === PTRUSE . ERASE ) { if ( ( ptr . propDesc . isScalar ( ) || ! ptr . collectionElement ) && ! ptr . propDesc . optional ) throw new common . X2SyntaxError ( ` ${ ptr . propPath } ` ) ; } // return the resolved pointer return ptr ; }
Resolve property pointer.

@private
@param {module:x2node-records~RecordTypeDescriptor} recordTypeDesc Record type
descriptor.
@param {string} propPointer Property pointer.
@param {boolean} noDash <code>true</code> if dash at the end of the array
property pointer is disallowed (in the context of the patch operation).
@param {Symbol} ptrUse Intended property use in the patch operation.
@returns {module:x2node-pointers~RecordElementPointer} The resolved property.
@throws {module:x2node-common.X2SyntaxError} If the pointer is invalid.
Resolve property pointer .