A function that accepts up to two arguments, the key name and the current value of the property represented by the key.
Optional
thisArg: any[Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, null or undefined the object will be used as the this value.
function performAction<T>(target: T, source: any) {
if (!isNullOrUndefined(source)) {
objForEachKey(source, (key, value) => {
// Set the target with a reference to the same value with the same name
target[key] = value;
});
}
return target;
}
Calls the provided
callbackFn
function once for each key in an object. This is equivelent toarrForEach(Object.keys(theObject), callbackFn)
or if not using the array helperObject.keys(theObject).forEach(callbackFn)
except that this helper avoid creating a temporary of the object keys before iterating over them and like thearrForEach
helper you CAN stop or break the iteration by returning -1 from thecallbackFn
function.