flatten index.js