Skip to content

Documentation / @warp-drive/legacy / compat / normalize

ts
function normalize(
   this, 
   modelName, 
   payload): SingleResourceDocument;

Defined in: warp-drive-packages/legacy/src/compat.ts:177

normalize converts a json payload into the normalized form that push expects.

Example

js
socket.on('message', function(message) {
  let modelName = message.model;
  let data = message.data;
  store.push(store.normalize(modelName, data));
});

Parameters

this

default

modelName

string

The name of the model type for this payload

payload

ObjectValue

Returns

SingleResourceDocument

The normalized payload

Released under the MIT License.