DB Folder - Javascript for optionFormula

What I’m trying to do

I am using DB Folder and want to use a formula to generate select field options based on notes in a specific folder.

The plugin author has provided this example script that generates options from tags:

function tagsAsOptions(db) {
options = [];
tagArray = app.metadataCache.getTags(); // Record<string, number>
Object.keys(tagArray).forEach(tag => {
options.push({
value: tag,
label: tag.slice(1),
color: db.colors.randomColor()
})
});
return options;
}

module.exports = tagsAsOptions;

I am looking to create a similar script that pulls the options from the names of files in a folder called “lists”.

Things I have tried

I’ve tried a lot, but I’m mostly clueless when it comes to js. I don’t know the query I need to grab the data, and I don’t know javascript enough to push that into the options array. Any help would be appreciated.