.rename() - DarthJDG/Mangler.js GitHub Wiki
Renames matching strings or object property names.
.rename(dictionary)| Parameter | Type | Default | Description |
|---|---|---|---|
| dictionary | Object | Dictionary of strings to replace. |
Returns the mangler object itself for chaining.
The dictionary is a simple object containing string pairs to rename:
{
'rename this string': 'to this string'
}Rename processes all items in the mangler object. Depending on the type of the item, rename works differently:
| Type | Action |
|---|---|
| string | Replaces the string if found in the dictionary. |
| object | Renames all matching object property names. |
Rename doesn't process objects recursively, it only changes top-level properties.