lib/record-patch-builder.js
function needsAdd(ptr, record, value) {

	const propDesc = ptr.propDesc;

	if (propDesc.isArray()) {
		if (ptr.collectionElement)
			return true;
		if (propDesc.scalarValueType === 'object')
			return !equalObjectArrays(/*ptr.getValue(record), value*/);
		return !equalSimpleArrays(ptr.getValue(record), value);
	}

	if (propDesc.isMap() && !ptr.collectionElement) {
		if (propDesc.scalarValueType === 'object')
			return !equalObjectMaps(/*ptr.getValue(record), value*/);
		return !equalSimpleMaps(ptr.getValue(record), value);
	}

	if (propDesc.scalarValueType === 'object')
		return !equalObjects(/*ptr.getValue(record), value*/);

	return (ptr.getValue(record) !== value);
}
function needsAdd(ptr, record, value) {

	const propDesc = ptr.propDesc;

	if (propDesc.isArray()) {
		if (ptr.collectionElement)
			return true;
		if (propDesc.scalarValueType === 'object')
			return !equalObjectArrays(/*ptr.getValue(record), value*/);
		return !equalSimpleArrays(ptr.getValue(record), value);
	}

	if (propDesc.isMap() && !ptr.collectionElement) {
		if (propDesc.scalarValueType === 'object')
			return !equalObjectMaps(/*ptr.getValue(record), value*/);
		return !equalSimpleMaps(ptr.getValue(record), value);
	}

	if (propDesc.scalarValueType === 'object')
		return !equalObjects(/*ptr.getValue(record), value*/);

	return (ptr.getValue(record) !== value);
}
function needsAdd ( ptr , record , value ) { const propDesc = ptr . propDesc ; if ( propDesc . isArray ( ) ) { if ( ptr . collectionElement ) return true ; if ( propDesc . scalarValueType === 'object' ) return ! equalObjectArrays ( /*ptr.getValue(record), value*/ ) ; return ! equalSimpleArrays ( ptr . getValue ( record ) , value ) ; } if ( propDesc . isMap ( ) && ! ptr . collectionElement ) { if ( propDesc . scalarValueType === 'object' ) return ! equalObjectMaps ( /*ptr.getValue(record), value*/ ) ; return ! equalSimpleMaps ( ptr . getValue ( record ) , value ) ; } if ( propDesc . scalarValueType === 'object' ) return ! equalObjects ( /*ptr.getValue(record), value*/ ) ; return ( ptr . getValue ( record ) !== value ) ; }
Tell if anything needs to be done to "add" the specified value at the
specified by the pointer location in the specified record.

@private
@param {module:x2node-pointers~RecordElementPointer} ptr The pointer.
@param {Object} record The record.
@param {*} value The value.
@returns {boolean} <code>true</code> if "add" patch operation would change the
record.
Tell if anything needs to be done to add the specified value at the specified by the pointer location in the specified record .