Stew.get() - shysolocup/stews GitHub Wiki
gets an entry by index or key
type: Function
works the same as:
Stew[entry];
Stew.key
alt names:
- at()
arguments:
- entry
Any
:
index or key to get
list: | pair: |
const { Stew } = require('stews');
let arr = new Stew([ "val1", "val2" ]);
console.log(arr.get("val1"));
console.log(arr.get(0));
// these work the same
arr["val1"];
arr[0]; |
const { Stew } = require('stews');
let obj = new Stew({ key1: "val1" });
console.log(obj.get("key1"));
console.log(obj.get(0));
// these work the same
obj["key1"];
obj[0]; |
"val1" // get by key
"val1" // get by index |
"val1" // get by key
"val1" // get by index |