n-qdeprecated

fixed size LRU array

Usage no npm install needed!

<script type="module">
  import nQ from 'https://cdn.skypack.dev/n-q';
</script>

README

n-q Build Status js-standard-style

fixed size LRU array

Usage

Installation:

Use yarn or npm:

$ [sudo] npm install n-q --save

Example:

var Nq = require('n-q')

// create a fixed size array, the length will never change
// only the contents
var queue = new Nq(3)

queue.toArray() // [null, null, null]

queue
  .push(1) // [1, null, null]
  .push(3) // [1, 3, null]
  .push(3) // [1, 3, 3]
  .push(7) // [7, 3, 3]

queue.toArray() // => [7, 3, 3]