Provide JS Modules export?
See original GitHub issueHi @sindresorhus!
This module is pretty popular, and its functionality is fairly segmented (get vs set). I’m willing to bet a decent number of people are only using this to safely retrieve the value at a dotted path (not set).
Given that assumption, I was wondering if you’d be open to providing a JS Modules version where { set, get } are named exports? I’d be happy to open a PR, though I’d need to know what solution you’d prefer for transpiling modules to commonjs (I’m biased).
Cheers!
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Understanding module.exports and exports in Node.js
In this article, I'll examine how to work with modules in Node.js, focusing on how to export and consume them.
Read more >module.exports – How to Export in Node.js and JavaScript
Each file in a Node.js project is treated as a module that can export values to be used by other modules. module.exports is...
Read more >export - JavaScript - MDN Web Docs
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the ......
Read more >Node.js Export Module - TutorialsTeacher
The module.exports is a special object which is included in every JavaScript file in the Node.js application by default. The module is a...
Read more >Node.js Module Exports - Demystified - Stackify
Module exports are the instruction that tells Node.js which bits of code (functions, objects, strings, etc.) to “export” from a given file so ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If they are going to be “named exports”, I think it would make sense to make them named something like
import {getProperty, deleteProperty} from 'dot-props';. Thoughts?Just another perspective: I actually use the
import { get } from 'dot-prop'a lot in a large API project, and it seems pretty readable to me. An example route handler might look like:Coming from projects that use
lodashwith the_a lot, I feel like_.get(is just as readable asget(but I am all for making names more wordy: