# nv-data-fixed-queue

> fixed-queue from nodejs lib/internal/fixed_queue.js

Latest version **1.0.0** (published 2021-02-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-data-fixed-queue
pnpm add nv-data-fixed-queue
yarn add nv-data-fixed-queue
bun add nv-data-fixed-queue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-02-12 |
| First published | 2021-02-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |
| Keywords | fixed-queue, fixed-circular-buffer |

## Links

- npm: https://www.npmjs.com/package/nv-data-fixed-queue
- npm.io page: https://npm.io/package/nv-data-fixed-queue

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-02-12

## README

nv-data-fixed-queue
============
- nv-data-fixed-queue 
- wrap of https://github.com/nodejs/node/blob/178e52a7ead2ef9ffb6eb5e17be167f17beb45a8/lib/internal/fixed_queue.js

install
=======
- npm install nv-data-fixed-queue 

usage
=====
    
- the code is from nodejs  lib/internal/fixed\_queue.js 
- this structure is used in nodejs as a task-queue
- its useful when you modify nodejs 

example
-------

    var {FixedCircularBuffer} = require("nv-data-fixed-queue")
    var cir = new FixedCircularBuffer(4)

    /*
    > cir
    FixedCircularBuffer {
      bottom: 0,
      top: 0,
      list: [ <4 empty items> ],
      next: null
    }
    > cir.push('a')
    undefined
    > cir
    FixedCircularBuffer {
      bottom: 0,
      top: 1,
      list: [ 'a', <3 empty items> ],
               |     |
              bot   top
      next: null
    }
    >
    > cir.push('b')
    undefined
    > cir
    FixedCircularBuffer {
      bottom: 0,
      top: 2,
      list: [ 'a', 'b', <2 empty items> ],
               |         |
              bot       top
      next: null
    }
    > cir.shift()
    'a'
    >
    > cir
    FixedCircularBuffer {
      bottom: 1,
      top: 2,
      list: [ undefined, 'b', <2 empty items> ],
                          |    |
                          bot top
      next: null
    }
    >
    > cir.shift()
    'b'
    >
    > cir
    FixedCircularBuffer {
      bottom: 2,
      top: 2,
      list: [ undefined, undefined, <2 empty items> ],
      next: null
    }
    >
    > cir.isEmpty()
    true
    >

    */

    /*
    var cir = new FixedCircularBuffer(4)
    > cir
    FixedCircularBuffer {
      bottom: 0,
      top: 3,
      list: [ 'a', 'b', 'c', <1 empty item> ],
                                 |
                                4 -1 =3  means full
      next: null
    }
    > cir.isFull()  ----------> extra-slot
    true
    >

    */

    var {FixedQueue} = require("nv-data-fixed-queue")
    var queue = new FixedQueue(4)
    /*
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 0,
        top: 0,
        list: [ <4 empty items> ],
        next: null
      },
      head: FixedCircularBuffer {
        bottom: 0,
        top: 0,
        list: [ <4 empty items> ],
        next: null
      }
    }
    > queue.push('a')
    undefined
    > queue.push('b')
    undefined
    > queue.push('c')
    undefined
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 0,
        top: 3,
        list: [ 'a', 'b', 'c', <1 empty item> ],
        next: null
      },
      head: FixedCircularBuffer {
        bottom: 0,
        top: 3,
        list: [ 'a', 'b', 'c', <1 empty item> ],
        next: null
      }
    }
    > queue.push('d')
    undefined
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 0,
        top: 3,
        list: [ 'a', 'b', 'c', <1 empty item> ],
        next: FixedCircularBuffer {
          bottom: 0,
          top: 1,
          list: [Array],
          next: null
        }
      },
      head: FixedCircularBuffer {
        bottom: 0,
        top: 1,
        list: [ 'd', <3 empty items> ],
        next: null
      }
    }
    > queue.push('e')
    undefined
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 0,
        top: 3,
        list: [ 'a', 'b', 'c', <1 empty item> ],
        next: FixedCircularBuffer {
          bottom: 0,
          top: 2,
          list: [Array],
          next: null
        }
      },
      head: FixedCircularBuffer {
        bottom: 0,
        top: 2,
        list: [ 'd', 'e', <2 empty items> ],
        next: null
      }
    }
    > queue.shift()
    'a'
    > queue.shift()
    'b'
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 2,
        top: 3,
        list: [ undefined, undefined, 'c', <1 empty item> ],
        next: FixedCircularBuffer {
          bottom: 0,
          top: 2,
          list: [Array],
          next: null
        }
      },
      head: FixedCircularBuffer {
        bottom: 0,
        top: 2,
        list: [ 'd', 'e', <2 empty items> ],
        next: null
      }
    }
    > queue.shift()
    'c'
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 0,
        top: 2,
        list: [ 'd', 'e', <2 empty items> ],
        next: null
      },
      head: FixedCircularBuffer {
        bottom: 0,
        top: 2,
        list: [ 'd', 'e', <2 empty items> ],
        next: null
      }
    }
    > queue.shift()
    'd'
    > queue.shift()
    'e'
    > queue
    FixedQueue {
      tail: FixedCircularBuffer {
        bottom: 2,
        top: 2,
        list: [ undefined, undefined, <2 empty items> ],
        next: null
      },
      head: FixedCircularBuffer {
        bottom: 2,
        top: 2,
        list: [ undefined, undefined, <2 empty items> ],
        next: null
      }
    }
    >

    */


API
====

- FixedCircularBuffer(kSize =2048) 
- FixedQueue(kSize =2048)

LICENSE
=======
- ISC

---
_Source: https://npm.io/package/nv-data-fixed-queue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
