Skip to content

Soup.first()

github-actions[bot] edited this page Sep 30, 2024 · 3 revisions

gets the first entry
type: Function

alt names:

  • front()
  • start()

arguments:

  • ?offset Number
    optional offset from the first index

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


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


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


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


console.log(obj.first());
console.log(obj.first(1));
"a" // offset of 0 gets the first entry
"b" // offset of 1 gets the second entry
{ key: "key1", value: "val1", index: 0 } // offset of 0 gets the first entry
{ key: "key2", value: "val2", index: 0 } // offset of 1 gets the second entry


Stews Docs 🍲

🛈 Stew 🛈 Soup
🛈 Noodle 🛈 random

Clone this wiki locally