I'm trying packages many file objects into a module, and them import all of them... then iterate over all of them.
landingData.js:
import { clientLinks, linkName } from "../Utils/index.js";
const landing = {
linkName: linkName.landing,
link: internLinks.landing,
keyWords: [],
pageContent: {},
externLinks: {},
internLinks: {},
imgAltNames: {},
documents: {},
videos: {}
}
export { landing }
aboutData.js:
import { clientLinks, linkName } from "../Utils/index.js";
const about = {
linkName: linkName.about,
link: internLinks.about,
keyWords: [],
pageContent: {},
externLinks: {},
internLinks: {},
imgAltNames: {},
documents: {},
videos: {}
}
export { about }
contactData.js:
import { clientLinks, linkName } from "../Utils/index.js";
const contact = {
linkName: linkName.contact,
link: internLinks.contact,
keyWords: [],
pageContent: {},
externLinks: {},
internLinks: {},
imgAltNames: {},
documents: {},
videos: {}
}
export { contact }
index.js:
import { landing } from "./landingData.js";
import { about } from "./aboutData.js";
import { contact } from "./contactData.js";
export {
landing,
about,
contact
}
Now here is where I try to import the module dynamically and iterate over all the objects in the module.
import * as dataModule from "./Content/index.js"
console.log(dataModule); // Working, I can see all 3 objects in the module
// Need code here to iterate over objects in the module.
I can't seem to find anything related to what I am trying to do here. Anyone have any ideas?