Soup.set() - shysolocup/stews GitHub Wiki

edits a value by index or key
type: Function

works the same as:

Soup[entry] = value;
Soup.key = value;

alt names:

  • edit()

arguments:

  • entry Any:
    index or key to set at
  • value Any:
    value to set

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


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


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


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


let obj = new Soup({ key1: "val1", key2: "valX", key3: "valY", key4: "val4" });


obj.set(1, "val2");
obj.set("key3", "val3");


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


⚠️ **GitHub.com Fallback** ⚠️