Guides  ›  State helpers  ›  Revive ← PREV NEXT →

Revive

Transform nested values in place, deepest first.

function handler(state) {
  var data = {
    user: { created: '2026-01-01T00:00:00.000Z' }
  }

  state.revive(data, function (key, value) {
    return key === 'created' ? new Date(value) : value
  })

  console.log(data.user.created instanceof Date) // true
  return data
}

Works with objects and arrays. The callback receives each property's key and value, not the root object itself.

Next: JARPC →

Tools for business systems.