refactor(index.js): removed lodash.findindex dependency
refactor(index.js): inline flattenExpansion