Created
May 26, 2012 03:51
-
-
Save kuyseng/2792054 to your computer and use it in GitHub Desktop.
javascript: indesign filter files regexp
This file contains hidden or 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
function filter_files (param_files, file_name_part) { | |
var all_files = param_files || []; | |
var selected_files = []; | |
var my_reg = new RegExp(file_name_part); | |
if(all_files.length === 0 ) {return [];} | |
for (var i = 0, len = all_files.length; i < len; i++) { | |
if(my_reg.test(all_files[i].name)) { | |
selected_files.push(all_files[i]); | |
}; | |
}; | |
return selected_files; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment