time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1341B)


      1 
      2 {{alias}}( buffer )
      3     Circular buffer constructor.
      4 
      5     Parameters
      6     ----------
      7     buffer: integer|ArrayLike
      8         Buffer size or an array-like object to use as the underlying buffer.
      9 
     10     Returns
     11     -------
     12     buf: Object
     13         Circular buffer data structure.
     14 
     15     buf.clear: Function
     16         Clears the buffer.
     17 
     18     buf.count: integer
     19         Number of elements currently in the buffer.
     20 
     21     buf.full: boolean
     22         Boolean indicating whether the buffer is full.
     23 
     24     buf.iterator: Function
     25         Returns an iterator for iterating over a buffer. If an environment
     26         supports Symbol.iterator, the returned iterator is iterable. Note that a
     27         returned iterator does **not** iterate over partially full buffers.
     28 
     29     buf.length: integer
     30         Buffer length (capacity).
     31 
     32     buf.push: Function
     33         Adds a value to the buffer. If the buffer is full, the method returns
     34         the removed value; otherwise, the method returns `undefined`.
     35 
     36     buf.toArray: Function
     37         Returns an array of buffer values.
     38 
     39     buf.toJSON: Function
     40         Serializes a circular buffer as JSON.
     41 
     42     Examples
     43     --------
     44     > var b = {{alias}}( 3 );
     45     > b.push( 'foo' );
     46     > b.push( 'bar' );
     47     > b.push( 'beep' );
     48     > b.length
     49     3
     50     > b.count
     51     3
     52     > b.push( 'boop' )
     53     'foo'
     54 
     55     See Also
     56     --------
     57