Skip to content

Rekeying Transformer

Defining a rekey section

Rekeying is used to change a key from one value to another; without changing the associated data value. It will set a value for the newKey, if there is an oldKey property even if the old value is Falsy.

Property Slug Description
processor 'REKEY'
rekeyTransformersKey The key to the object with the rekey property slug changes
rekeyDelete true or false Determines if the old key should be kept after setting the value on the new key. Default is false
rekeyKeepMissingValues true or false Determines if a value should be set if the object doesn't have a property with the old key.

Here is an example of the rekey processor TransformTask

///map file data
direction:{
  transformOrder: [
    { processor: 'REKEY', rekeyDelete: true, rekeyTransformersKey: 'rekey' },],
  rekey: {
    vibeIQIdentifier: 'itemNumber'
  }
}
///end map file data

const data = {
  name: 'Bob',
  itemNumber: 1045
}

//... transform data

//Expected results
//{
//  name: 'Bob',
//  vibeIQIdentifier: 1045
//}