I'd like to import specific functions from another module. But I faced naming collision: I have similar function names in my importing file. I'd like to do something like this:
// exporterFile.js
export {
set,
get,
has,
foo,
bar,
}
// implementation code for set, get, etc.
// importerFile.js
import {get, set} as exporter from "exporterFile.js"
function get() {
// some code and call set from exporter
exporter.set(something)
}
I know I could import * as exporter from "exporterFile.js"
but it lacks readability and does not show what methods (functions) I am using from the exporter file.
Also, I know I could import {get as exporterGet, set as exporterSet} from "exporterFile.js"
but it is not so readable.
Is there an elegant, clear, readable way to import selected functions from a module without naming collision? If not, what is the best practice and approach and suggestion: readability is very important, tree-shaking is a consideration as well.