Copies all properties/keys of the specifed args and creates a new object with those properties assigned to it.

Parameters:
NameTypeDescription
argsobject

The objects that will be used as the source of data. This function takes any number of objects as arguments. If more than one argument share the same property name, the property of the last argument will be used.

Since
  • 1.0.0
Returns:

Returns a new object, with properties copied/assigned from the provided arguments.

Type: 
object
Example
import { objectAssign } from "@gravityforms/utils";

function Example() {
	 const obj1 = { 'prop1' : 'val1' };
	 const obj2 = {
		 'prop2' : { 'sub1' : 'subval1' },
		 'prop3' : [1, 2, 3],
	 }
	 const obj3 = { 'prop1' : 'val2' };

	 const newObject = objectAssign( obj1, obj2, obj3 );
}