Git Product home page Git Product logo

cbuffer's People

Contributors

adrieankhisbe avatar dfellis avatar dotnetcarpenter avatar gyeates avatar iamolivinius avatar matheus28 avatar proloser avatar russaa avatar shimondoodkin avatar trevnorris avatar wherget avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cbuffer's Issues

rotateLeft/Right

Add rotateLeft() and rotateRight() to the API. Should be simple enough. Just move the pointers right/left by count.

convenience method for length

Is there a way to get the total number of items in the buffer?

Also, I want to completely dump the buffer by calling .pop() in iteration. Can I call .pop and then check the size until the size is zero?

Missing bower main section

The bower.json file may contain the main property to prevent problems with build systems who need that.

The primary acting files necessary to use your package. While Bower does not directly use these files, they are listed with the commands bower list --json andbower list --paths, so they can be used by build tools.

Semantics of length and size switched?

I was trying to use this for backing a d3.js graph, and after a bit of debugging found that (to me) it looks like the semantics of .length and .size are the wrong way around. That is to say, for a "plain" JS Array, .length is (usually, except for some edge cases) the number of elements in the array, what is CBuffer.size here.

For using CBuffer as a "drop-in" replacement for a plain old Array, exchanging these meanings might be helpful. What do you think?

Add method or attribute to check whether buffer is full

I have a case where I fill the buffer and do some action only when it's full. Could you add a method or attribute to check whether the buffer is full? Or is there already such a thing that I overlooked?

Of course checking buffer.size == buffer.length works too, but a more explicit helper method would be nice :)

shift may need to unset shifted item in data array

var b = new CBuffer(10);
b.push(1, 2, 3, 4, 5);
b.rotateLeft();
b.sort();
b.toArray();

=> [1, 1, 2, 3, 4]

Seems the culprit is the use of shift in rotateLeft, which moves the start index but leaves the shifted item in the underlying array. Explicitly setting that array index to undefined seems to fix the above. Not sure if it would have other consequences.

Thanks for the implementation!

Implement Quicksort

Consider implementation of a quicksort. This would be especially useful once Typed Array Views and Buffers are supported.

fill method

Hi, thanks for your useful class. I'm using it with the latest node (0.8.11)

With current version, it looks like 'fill' does not actually fill the entire buffer, but only the first value. For instance,

var cb = new CBuffer(10);
cb.fill(0);

Then,

console.log(cb.data)

or

console.log(cb.toArray())

show that only the first value was set to 0, the other values remain null.

{ start: 0,
  size: 0,
  overflow: false,
  data: [ 0, , , , , , , , ,  ],
  length: 10,
  end: 9 }

If confirmed on your side, could you please explain how to get the expected behavior or fix the issue?

Cheers

Declare License

Nice project. Could you maybe declare its license? Or did I just overlook it?

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.