I found this very useful script on here for iteratively returning a list of file metrics by directory in GDrive. My problem is I want to add columns that exclude emails from a give domain. For example on the fileItem.getEditors I might want to return a list excluding editors in the "@mycompany.com" domain.
var childFolders = parent.getFolders();
var childFiles = parent.getFiles();
var allValues = []; // Added
while (childFiles.hasNext()){
var fileItem = childFiles.next();
data = [
parentName + "/" + fileItem.getName() + "/" + fileItem.getName(),
fileItem.getName(),
fileItem.getMimeType(),
fileItem.getUrl(),
fileItem.getAccess(Session.getActiveUser()),
fileItem.getSharingPermission(),
fileItem.isShareableByEditors(),
fileItem.getOwner().getEmail(),
fileItem.getEditors().map(function(e){return [e.getEmail(), e.getName()]}).join(","),
fileItem.getViewers().map(function(e){return [e.getEmail(), e.getName()]}).join(","),
];
allValues.push(data); // Added
}
sheet.getRange(sheet.getLastRow() + 1, 1, allValues.length, allValues[0].length).setValues(allValues); // Added
Cooper's answer is already great but you don't need to include @ on the comparison.
Filter your data by adding filter before the map that gets the email and name:
.filter(function(e){e.getDomain() != "mycompany.com"})
Output:
fileItem.getEditors().filter(function(e){e.getDomain() != "mycompany.com"})
.map(function(e){return [e.getEmail(), e.getName()]}).join(","),