Skip to content

Soup.rename()

github-actions[bot] edited this page Sep 30, 2024 · 3 revisions

edits a key by key or index
type: Function

arguments:

  • entry Any:
    index or key to rename at
  • value String:
    value to set the key to

list: pair:
const { Soup } = require('stews');


let arr = new Soup([ "a", "x", "y" ]);


arr.rename(1, "b");
arr.rename("y", "c");


console.log(arr);
const { Soup } = require('stews');


let obj = new Soup({ key1: "val1", keyX: "val2", keyY: "val3" });


obj.rename(1, "key2");
obj.rename("keyY", "key3");


console.log(obj);
Soup(3) [ "a", "b", "c" ]
Soup(3) { key1: "val1", key2: "val2", key3: "val3" }


Stews Docs 🍲

🛈 Stew 🛈 Soup
🛈 Noodle 🛈 random

Clone this wiki locally