Given an example:
We have a model called ServiceClient
class A {
constructor() {
this.propA = '1';
}
}
class B {
constructor() {
this.propB = '2';
}
}
module.exports = {
A: new A(),
B: new B(),
}
In AppHelper after importDir the call of flat will expand properties of object instance and adding the value to global context.
With the example above, the global context will contain 2 variables
ServiceClient_A_propA=1
ServiceClient_B_propB=2