updateOrAdd

function
 updateOrAdd() 

Option name Type Description
- String, Object, Array.<Object>

id or object with .id property, or array of properties

[properties] Object

If id passed, properties for new or existing object

return Promise

updates existing object, or creates otherwise.

function updateOrAdd (idOrObjectOrArray, newObject) {
  return Array.isArray(idOrObjectOrArray)
    ? updateOrAddMany.call(this, idOrObjectOrArray)
    : updateOrAddOne.call(this, idOrObjectOrArray, newObject)
}