I am trying to understand the magic in macro.js, I am looking at
imageData.getPointData()
, and once I step into it with chrome I suddenly get this
export function get(publicAPI, model, fieldNames) {
fieldNames.forEach((field) => {
if (typeof field === ‘object’) {
publicAPI[get${capitalize(field.name)}] = () => model[field.name];
} else {
publicAPI[get${capitalize(field)}] = () => model[field];
}
});
}
I cannot find where model[] is defined, although it is used everywhere in macro.js. Why a function without any parameters suddenly becomes a function with three parameters. What technique was employed here, there is no comment in macro.js for its usage, any documentation to understand this huge jump in code logic?
Any tip would be great, thanks!