jbmusso / grex

JavaScript graph database client for TinkerPop2 Rexster
MIT License
46 stars 12 forks source link

Updating isGraphReference() to avoid Regex testing #18

Closed jbmusso closed 11 years ago

jbmusso commented 11 years ago

Following your comment on this commit (https://github.com/gulthor/grex/commit/a31104bfa538c6ea1ebebf2068610b7380788b37#commitcomment-4294676), I was thinking that Utils.isGraphReference() could be changed to either of the following ways:

This would give the advantage of simply having to append stuff to classes.js without having to simultaneously update the Regex when adding more graph references in the future.

There might be a performance improvement as well, though quite minor :P.

If that's fine with you, I can try working on this minor update.

fattenap commented 11 years ago

Sounds good.

The reason I use regex is because I needed to analyse a string, but happy if you can make it work because, as you say, it would make it easier to add stuff as things change. I'd probably opt for the second approach if possible, but I'm happy for you to modify as you see fit.

On 10 October 2013 20:12, Jean-Baptiste Musso notifications@github.comwrote:

Following your comment on this commit (gulthor@a31104b

commitcomment-4294676https://github.com/gulthor/grex/commit/a31104bfa538c6ea1ebebf2068610b7380788b37#commitcomment-4294676),

I was thinking that Utils.isGraphReference() could be changed to either of the following ways:

  • either dynamically generate the regex from classes definition in classes.js
  • remove regex test, and test for graph references existence with something like classes.hasOwnProperty()

This would give the advantage of simply having to append stuff to classes.js without having to simultaneously update the Regex when adding more graph references in the future.

There might be a performance improvement as well, though quite minor :P.

If that's fine with you, I can try working on this minor update.

— Reply to this email directly or view it on GitHubhttps://github.com/entrendipity/grex/issues/18 .