client/extensions/woocommerce/state/ui/products/variations/edits-reducer.js
function updateProductEdits( edits, productId, doUpdate ) {
	const prevEdits = edits || [];
	let found = false;

	const newEdits = prevEdits.map( productEdits => {
		if ( isEqual( productId, productEdits.productId ) ) {
			found = true;
			return doUpdate( productEdits );
		}
		return productEdits;
	} );

	if ( ! found ) {
		newEdits.push( doUpdate( undefined ) );
	}

	return newEdits;
}
function updateProductEdits( edits, productId, doUpdate ) {
	const prevEdits = edits || [];
	let found = false;

	const newEdits = prevEdits.map( productEdits => {
		if ( isEqual( productId, productEdits.productId ) ) {
			found = true;
			return doUpdate( productEdits );
		}
		return productEdits;
	} );

	if ( ! found ) {
		newEdits.push( doUpdate( undefined ) );
	}

	return newEdits;
}
Updates an edits object for a specific product.

The main edits state contains an array of edits object, one for each
product to be edited. The edits object for a product is in this format:

```
{
productId: <Number|Object>,
creates: [ {<new variation object>} ]
updated: [ {<variation props to update>} ]
deletes: [ <variation id> ]
}
```

@param {Object} edits The state at `woocommerce.ui.products.variations.edits`
@param {Number|Object} productId The id of product edits object to be updating.
@param {Function} doUpdate ( productEdits ) Called with previous product edits, takes return as new product edits.
@return {Object} The new, updated product edits to be used in state.