Property Keys Reordering

Potency Low
Resilience High
Cost None
Tags: object, reorder, property, key

Description

Property Keys Reordering randomly reorders object literal's properties. The transformation doesn't reorder non-free side-effect expressions like IIFE, function calls, getter/setter, etc.

Code Annotation Example

// @jscrambler enable propertyKeysReordering

Example

The following example is an object literal with some properties:

var color = {
  red: "FF0000",
  blue: "0000FF",
  green: hexCode("green"),
  white: "FFFFFF"
}

red and blue properties are reordered but green, which value is a function call, is not:

var color = {
  blue: "0000FF",
  red: "FF0000",
  green: hexCode("green"),
  white: "FFFFFF"
}

Browser Compatibility

Browser Compatible Versions Tested Versions Notes
Chrome 80+ 80+
Firefox 90+ 90+
Internet Explorer 8+ 8+
Microsoft Edge 116+ 116+
Safari 13.1+ 13.1+

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "propertyKeysReordering"
    }
  ]
}