Soup.delete() - shysolocup/stews GitHub Wiki
deletes an entry by key or index
type: Function
works the same as:
delete Soup[entry];
delete Soup.key;
alt names:
- del()
- remove()
- rem()
arguments:
- entry
Any
:
index or key to delete
list: | pair: |
const { Soup } = require('stews');
let arr = new Soup([ "a", "d", "b", "c" ]);
arr.delete(1); // deletes "d"
console.log(arr); |
const { Soup } = require('stews');
let obj = new Soup({ key1: "val1", key3: "val3", key2: "val2" });
obj.delete(1); // deletes key3
console.log(obj); |
Soup(3) [ "a", "b", "c" ] |
Soup(2) { key1: "val1", key2: "val2" } |