lazy.js icon indicating copy to clipboard operation
lazy.js copied to clipboard

Minimal implementation? Where to start?

Open Download opened this issue 10 years ago • 0 comments

I am working on a small web database, WebDB, which supports 'queries' like this:

var results = db.someTable.get({someColumn:'some-value'});

In this example, results is an array with potentially thousands of records (depending on your query).

I have been reading about Lazy JS with much interest. I think the ideas behind the library are very good. So I'm very interested in integrating with it or at least using some of it's ideas.

Basically I would like my get function to return a Lazy sequence instead of an array.

The problem is: My library is currently only 12kB minified, whereas Lazy.js is 46kB... So just adding Lazy to my lib makes my library a LOT bigger... 58kB is way beyond what I'm comfortable with.

What I would like is either to use Lazy when it is available anyway, or (preferably) to use some minimal 'core' part of Lazy inside my own library.

Any tips? Could I maybe grab a small subset of Lazy to experiment with it?

Also, if I just ignore the size for now... If I want my get function to return a Lazy sequence, how should I go about it? Just wrapping the resulting array seems not so smart :) Are there examples of how to feed data into a sequence? I have seen something about emitting data, but that seemed to be specifically for event handling?

Download avatar Sep 23 '15 15:09 Download