The situation object containing all answers for a given simulation.
The migration instructions object.
The migrated situation (and foldedSteps if specified).
import { migrateSituation } from '@publicodes/tools/migration'
const situation = {
"age": 25
"job": "developer",
"city": "Paris"
}
const instructions = {
keysToMigrate: {
// The rule `age` will be renamed to `âge`.
age: 'âge',
// The rule `city` will be removed.
city: ''
},
valuesToMigrate: {
job: {
// The value `developer` will be translated to `développeur`.
developer: 'développeur'
}
}
}
migrateSituation(situation, instructions) // { "âge": 25, "job": "'développeur'" }
An example of instructions can be found here.
Generated using TypeDoc
Migrate a situation from an old version of a model to a new version according to the provided migration instructions.