Giter Club home page Giter Club logo

Comments (5)

tjmehta avatar tjmehta commented on September 2, 2024

Quick thoughts: I like this idea a lot (splitting each operation into it's own module/file)

from keypather.

stoeffel avatar stoeffel commented on September 2, 2024

👍

I think #10 could be solved with this one too.

from keypather.

justsml avatar justsml commented on September 2, 2024

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 require('./lib/xyz') design - accessing state-less/instance-less feature methods). So index.js would look like a little like this: exports.get = require('./lib/get') this would make it 'instance-free' and each call's lifetime is clearly scoped: run's in it's own closure, allowing better garbage collection

Current progress/thoughts

  1. I've been re-factoring the getValue fn and it's dependent method chain,
    1. Moved fns: handleKey, handleFunction, handleBrackets under getValue
  2. Can in() and has() be updated to use get() directly?

from keypather.

justsml avatar justsml commented on September 2, 2024

Other thoughts

In 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)
I typically design a plugin interface with members like: run(obj), int priority (maybe a hasRun(obj) et al.)
For keypather, I think a plugin interface method like canRun(keyPath) or isNeeded(keyPath) would cleanly separate the main class out, so it's just a coordinator/controller simply running 'steps'

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')])

from keypather.

tjmehta avatar tjmehta commented on September 2, 2024

published [email protected] !

from keypather.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.