Soup.forEach() - shysolocup/stews GitHub Wiki
goes through every entry
type: Function
arguments:
- func
Function
:
goes through every entry and runs the function with the info
sub arguments:
list: pair: <value
Any
>
<indexNumber
>
.forEach( (value, index) => { } );<key
String
>
<valueAny
>
<indexNumber
>.forEach( (key, value, index) => { } );
list: | pair: |
const { Soup } = require('stews');
let arr = new Soup([ "a", "b" ]);
arr.forEach( (v, i) => {
console.log(v, i);
}); |
const { Soup } = require('stews');
let obj = new Soup({ key1: "val1", key2: "val2" });
obj.forEach( (k, v, i) => {
console.log(k, v, i);
}); |
"a" 0
"b" 1 |
"key1" "val1" 0
"key2" "val2" 1 |