Soup.push() - shysolocup/stews GitHub Wiki
adds a new entry to the end
type: Function
alt names:
- push_back()
arguments:
- key/value
Any
key or value to push
for lists you only use the value
- ?value
Any
optional value to push
only used in pairs
list: | pair: |
const { Soup } = require('stews');
let arr = new Soup([ "a", "b" ]);
arr.push("c");
console.log(arr); |
const { Soup } = require('stews');
let obj = new Soup({ key1: "val1", key2: "val2" });
obj.push("key3", "val3");
console.log(obj); |
Soup(3) [ "a", "b", "c" ] |
Soup(3) { key1: "val1", key2: "val2", key3: "val3" } |