-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More modular design #11
Comments
Quick thoughts: I like this idea a lot (splitting each operation into it's own module/file) |
👍 I think #10 could be solved with this one too. |
Hey @tjmehta ... In trying to decompose the index.js and it's methods, I've made the code a little uglier I feel. (I'll reference my branch when I load it... ) Let me explain where I'm at: I love seeing solid use of prototype like this, however I'm currently breaking it up into more basic utility-function design ( sub-classes and prototype might be overkill for this. Ultimately I think a skinny+modular design will come from using a direct Current progress/thoughts
|
Other thoughtsIn order to design (what I think is) an ideal plugin model, I usually assume an infinite possible # of plugins... While this is probably not a likely requirement for a module with most functionality included - hopefully this will just make code more tightly scoped) This should also allow for more isomorphic usage patterns - perhaps like this: var basicGet = Keypather.run.bind([require('./plugins/dottedPaths'), require('./plugins/expandPath')])
var getArray = Keypather.run.bind([require('./plugins/dottedPaths'), require('./plugins/arrayPaths'), require('./plugins/expandPath')]) |
published keypather@v3.0.0 ! |
I was trying to figure out the best way to make the code more modular/monad-like.
So, for example let's consider the path splitting features as chain-able modules:
dottedPaths
,arrayPaths
,functionPaths
, or something likecustomPathMapper
This would make it easier to exclude, say, function-path features (XS exploits come to mind), not to mention it'd be easier to make custom keypather builds. Like a light-weight read-only path checker for the browser would be really handy, especially on mobile.
Anyway, I was just wondering what @tjmehta thoughts are on this.
Thanks for the awesome lib!
The text was updated successfully, but these errors were encountered: