Stew.rename() - shysolocup/stews GitHub Wiki
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 { Stew } = require('stews');
let arr = new Stew([ "a", "x", "y" ]);
arr.rename(1, "b");
arr.rename("y", "c");
console.log(arr); |
const { Stew } = require('stews');
let obj = new Stew({ key1: "val1", keyX: "val2", keyY: "val3" });
obj.rename(1, "key2");
obj.rename("keyY", "key3");
console.log(obj); |
Stew(3) [ "a", "b", "c" ] |
Stew(3) { key1: "val1", key2: "val2", key3: "val3" } |