Created
June 2, 2018 02:07
-
-
Save ochaochaocha3/dd00ea004d3825254af2b1f2fab637b1 to your computer and use it in GitHub Desktop.
ファイル名の配列から .DS_Store を除外する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ファイル名の配列 | |
var files = [ | |
'dir/.DS_Store', 'dir/img.jpg', 'dir2/img2.png' | |
]; | |
// filterで.DS_Storeを除外する | |
files | |
.filter(filename => !filename.endsWith('.DS_Store')); | |
/* | |
dir/img.jpg,dir2/img2.png | |
*/ | |
// filterをかけた後イテレートする | |
files | |
.filter(filename => !filename.endsWith('.DS_Store')) | |
.forEach(filename => { | |
// 何かする | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment