Stew.set() - shysolocup/stews GitHub Wiki

edits a value by index or key
type: Function

works the same as:

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

alt names:

  • edit()

arguments:

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

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


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


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


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


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


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


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


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