Skip to content

Instantly share code, notes, and snippets.

@rogerwalt
Created Feb 20, 2020
Embed
What would you like to do?
const fileNames = ['one.js', 'two.scss', 'three.scss'];
const getAllFileNames = () => new Promise((resolve, reject) => { resolve(fileNames) })
const filterScssFiles = (fileNames) => new Promise((resolve, reject) => resolve(fileNames.filter(fileName => fileName.endsWith('.scss'))))
getAllFileNames().then(fileNames => filterScssFiles(fileNames))
.then(scssFileNames => console.log(scssFileNames))
.catch(err => console.error(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment