code: function build(recordTypes, recordTypeName, patch) {
  
  	// get the record type descriptor
  	if (!recordTypes.hasRecordType(recordTypeName))
  		throw new common.X2UsageError(
  			`Unknown record type ${recordTypeName}.`);
  	const recordTypeDesc = recordTypes.getRecordTypeDesc(recordTypeName);
  
  	// make sure the patch spec is an array
  	if (!Array.isArray(patch))
  		throw new common.X2SyntaxError('Patch specification is not an array.');
  
  	// process patch operations
  	const involvedPropPaths = new Set();
  	const updatedPropPaths = new Set();
  	const patchOps = patch.map((patchOpDef, opInd) => parsePatchOperation(
  		recordTypes, recordTypeDesc, patchOpDef, opInd,
  		involvedPropPaths, updatedPropPaths));
  
  	// return the patch object
  	return new RecordPatch(patchOps, involvedPropPaths, updatedPropPaths);
  }
docs: Build record patch object from JSON Patch specification.
  
  @function module:x2node-patches.build
  @param {module:x2node-records~RecordTypesLibrary} recordTypes Record types
  library.
  @param {string} recordTypeName Name of the record type, against records of
  which the patch will be applied.
  @param {Array.<Object>} patch RFC 6902 JSON patch specification.
  @returns {module:x2node-patches~RecordPatch} The patch object that can be used
  to apply the patch to records.
  @throws {module:x2node-common.X2UsageError} If the provided record type name
  is invalid.
  @throws {module:x2node-common.X2SyntaxError} If the provided patch
  specification is invalid.