Soup.append() - shysolocup/stews GitHub Wiki

inserts a new entry at a given index
type: Function

alt names:

  • insert()
  • push_at()
  • push_to()

arguments:

  • index Number
    index to append at
    puts the appended entry infront of the index
  • key/value Any
    key or value to append
    for lists you only use the value
  • ?value Any
    optional value to append
    only used in pairs

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

let arr = new Soup([ "a", "c" ]);

arr.append(1, "b");

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

let obj = new Soup({ key1: "val1", key3: "val3" });

obj.append(1, "key2", "val2");

console.log(obj);
Soup(3) [ "a", "b", "c" ]
Soup(3) { key1: "val1", key2: "val2", key3: "val3" }


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