Skip to content

Instantly share code, notes, and snippets.

@rogerwalt
Created February 20, 2020 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerwalt/2e899eae7cde0875ffadb4fab0a7f56d to your computer and use it in GitHub Desktop.
Save rogerwalt/2e899eae7cde0875ffadb4fab0a7f56d to your computer and use it in GitHub Desktop.
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