// moduleA.mjs
import {
wrapper
} from './moduleB.mjs';
const {
x
} = wrapper('./moduleB.mjs');
// moduleB.mjs (if you want multiple functions to have access to the name)
const wrapper = (nameOfFile) => {
const x = () => {
console.log(nameOfFile);
};
const y = () => {
console.log('some other function:', nameOfFile);
};
return {
x,
y,
};
}
export const wrapper;
// other approach, if you only want that one function wrapped
// moduleA.mjs
import {
wrapper
} from './moduleB.mjs';
const x = wrapper('./moduleB.mjs');
// moduleB.mjs
const wrapper = (nameOfFile) => (
(inputForX) => {
console.log(nameOfFile);
})
export const wrapper;