Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
export function importFilesFrom (folderContext, patternNameRegex) {
|
||||
const components = {};
|
||||
|
||||
folderContext.keys().forEach(filename => {
|
||||
const name = stripTokenFromString(filename, patternNameRegex);
|
||||
const component = folderContext(filename);
|
||||
components[name] = component.default;
|
||||
});
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function stripTokenFromString (string, patternNameRegex) {
|
||||
const results = patternNameRegex.exec(string);
|
||||
return results[1];
|
||||
}
|
||||
Reference in New Issue
Block a user