lib/record-patch-builder.js
function isValidRefValue(recordTypes, val, propDesc) {

	if ((typeof val) !== 'string')
		return false;

	const hashInd = val.indexOf('#');
	if ((hashInd <= 0) || (hashInd === val.length - 1))
		return false;

	const refTarget = val.substring(0, hashInd);
	if (refTarget !== propDesc.refTarget)
		return false;

	const refTargetDesc = recordTypes.getRecordTypeDesc(refTarget);
	const refIdPropDesc = refTargetDesc.getPropertyDesc(
		refTargetDesc.idPropertyName);

	if ((refIdPropDesc.scalarValueType === 'number') &&
		!Number.isFinite(Number(val.substring(hashInd + 1))))
		return false;

	return true;
}
function isValidRefValue(recordTypes, val, propDesc) {

	if ((typeof val) !== 'string')
		return false;

	const hashInd = val.indexOf('#');
	if ((hashInd <= 0) || (hashInd === val.length - 1))
		return false;

	const refTarget = val.substring(0, hashInd);
	if (refTarget !== propDesc.refTarget)
		return false;

	const refTargetDesc = recordTypes.getRecordTypeDesc(refTarget);
	const refIdPropDesc = refTargetDesc.getPropertyDesc(
		refTargetDesc.idPropertyName);

	if ((refIdPropDesc.scalarValueType === 'number') &&
		!Number.isFinite(Number(val.substring(hashInd + 1))))
		return false;

	return true;
}
function isValidRefValue ( recordTypes , val , propDesc ) { if ( ( typeof val ) !== 'string' ) return false ; const hashInd = val . indexOf ( '#' ) ; if ( ( hashInd <= 0 ) || ( hashInd === val . length - 1 ) ) return false ; const refTarget = val . substring ( 0 , hashInd ) ; if ( refTarget !== propDesc . refTarget ) return false ; const refTargetDesc = recordTypes . getRecordTypeDesc ( refTarget ) ; const refIdPropDesc = refTargetDesc . getPropertyDesc ( refTargetDesc . idPropertyName ) ; if ( ( refIdPropDesc . scalarValueType === 'number' ) && ! Number . isFinite ( Number ( val . substring ( hashInd + 1 ) ) ) ) return false ; return true ; }
Tell if the specified value is suitable to be the specified reference
property's value.

@private
@param {module:x2node-records~RecordTypesLibrary} recordTypes Record types
library.
@param {*} val The value to test.
@param {module:x2node-records~PropertyDescriptor} propDef Reference property
descriptor.
@returns {boolean} <code>true</code> if the value is a string (so not
<code>null</code> or <code>undefined</code> either) and matches the reference
property.
Tell if the specified value is suitable to be the specified reference property s value .