Socket
Socket
Sign inDemoInstall

denque

Package Overview
Dependencies
0
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.5 to 1.0.6

2

package.json
{
"name": "denque",
"version": "1.0.5",
"version": "1.0.6",
"description": "The fastest javascript implementation of a double-ended queue. Maintains compatability with deque.",

@@ -5,0 +5,0 @@ "main": "index.js",

'use strict';
const assert = require('assert');
const Denque = require('../');
var assert = require('assert');
var Denque = require('../es5');
describe('Denque.prototype.constructor', function () {
it("should take no argument", function () {
const a = new Denque();
var a = new Denque();
assert(a._capacityMask === 3);

@@ -16,4 +16,4 @@ assert(a._list.length === 4);

it("should take array argument", function () {
const a = new Denque([1, 2, 3, 4]);
const b = new Denque([]);
var a = new Denque([1, 2, 3, 4]);
var b = new Denque([]);

@@ -28,4 +28,4 @@ assert(a.length >= 4);

this.timeout(20000);
const denque = new Denque();
let l = 250000;
var denque = new Denque();
var l = 250000;

@@ -39,3 +39,3 @@ while (--l) {

while (--l) {
const a = denque.shift();
var a = denque.shift();
denque.pop();

@@ -81,3 +81,3 @@ denque.shift();

it("should return an array", function () {
const a = new Denque([1, 2, 3, 4]);
var a = new Denque([1, 2, 3, 4]);
assert.deepEqual(a.toArray(), [1, 2, 3, 4]);

@@ -89,5 +89,5 @@ });

it("Should do nothing if no arguments", function () {
const a = new Denque();
const before = a.length;
const ret = a.push();
var a = new Denque();
var before = a.length;
var ret = a.push();
assert(ret === before);

@@ -99,5 +99,5 @@ assert(a.length === ret);

it("Should add falsey elements (except undefined)", function () {
const a = new Denque();
// const before = a.length;
let ret = a.push(0);
var a = new Denque();
// var before = a.length;
var ret = a.push(0);
assert.strictEqual(ret, 1);

@@ -117,6 +117,6 @@ assert.strictEqual(a.length, 1);

it("Should add single argument - plenty of capacity", function () {
const a = new Denque([1, 2, 3, 4, 5]);
var a = new Denque([1, 2, 3, 4, 5]);
assert(a._list.length - a.length > 1);
const before = a.length;
const ret = a.push(1);
var before = a.length;
var ret = a.push(1);
assert(ret === before + 1);

@@ -129,6 +129,6 @@ assert(a.length === ret);

it("Should add single argument - exact capacity", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
assert(a._list.length - a.length === 1);
const before = a.length;
const ret = a.push(1);
var before = a.length;
var ret = a.push(1);
assert(ret === before + 1);

@@ -141,6 +141,6 @@ assert(a.length === ret);

it("Should add single argument - over capacity", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
assert(a._list.length / a.length === 2);
const before = a.length;
const ret = a.push(1);
var before = a.length;
var ret = a.push(1);
assert(ret === before + 1);

@@ -157,5 +157,5 @@ assert(a.length === ret);

it("Should do nothing if no arguments", function () {
const a = new Denque();
const before = a.length;
const ret = a.unshift();
var a = new Denque();
var before = a.length;
var ret = a.unshift();
assert(ret === before);

@@ -167,5 +167,5 @@ assert(a.length === ret);

it("Should unshift falsey elements (except undefined)", function () {
const a = new Denque();
// const before = a.length;
let ret = a.unshift(0);
var a = new Denque();
// var before = a.length;
var ret = a.unshift(0);
assert.strictEqual(ret, 1);

@@ -185,6 +185,6 @@ assert.strictEqual(a.length, 1);

it("Should add single argument - plenty of capacity", function () {
const a = new Denque([1, 2, 3, 4, 5]);
var a = new Denque([1, 2, 3, 4, 5]);
assert(a._list.length - a.length > 1);
const before = a.length;
const ret = a.unshift(1);
var before = a.length;
var ret = a.unshift(1);
assert(ret === before + 1);

@@ -197,6 +197,6 @@ assert(a.length === ret);

it("Should add single argument - exact capacity", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
assert(a._list.length - a.length === 1);
const before = a.length;
const ret = a.unshift(1);
var before = a.length;
var ret = a.unshift(1);
assert(ret === before + 1);

@@ -209,6 +209,6 @@ assert(a.length === ret);

it("Should add single argument - over capacity", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
assert(a._list.length / a.length === 2);
const before = a.length;
const ret = a.unshift(1);
var before = a.length;
var ret = a.unshift(1);
assert(ret === before + 1);

@@ -224,3 +224,3 @@ assert(a.length === ret);

it("Should return undefined when empty denque", function () {
const a = new Denque();
var a = new Denque();
assert(a.length === 0);

@@ -233,4 +233,4 @@ assert(a.pop() === void 0);

it("Should return the item at the back of the denque", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
const b = [];
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
var b = [];

@@ -270,3 +270,3 @@ b.push(1, 2, 3, 4, 5, 6, 7, 8, 9);

it("Should return undefined when empty denque", function () {
const a = new Denque();
var a = new Denque();
assert(a.length === 0);

@@ -279,4 +279,4 @@ assert(a.shift() === void 0);

it("Should return the item at the front of the denque", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
const b = [];
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
var b = [];

@@ -316,3 +316,3 @@ b.push(1, 2, 3, 4, 5, 6, 7, 8, 9);

it("should return undefined on nonsensical argument", function () {
const a = new Denque([1, 2, 3, 4]);
var a = new Denque([1, 2, 3, 4]);
assert(a.get(-5) === void 0);

@@ -330,3 +330,3 @@ assert(a.get(-100) === void 0);

it("should support positive indexing", function () {
const a = new Denque([1, 2, 3, 4]);
var a = new Denque([1, 2, 3, 4]);
assert(a.get(0) === 1);

@@ -339,3 +339,3 @@ assert(a.get(1) === 2);

it("should support negative indexing", function () {
const a = new Denque([1, 2, 3, 4]);
var a = new Denque([1, 2, 3, 4]);
assert(a.get(-1) === 4);

@@ -350,3 +350,3 @@ assert(a.get(-2) === 3);

it("should return true on empty denque", function () {
const a = new Denque();
var a = new Denque();
assert(a.isEmpty());

@@ -356,3 +356,3 @@ });

it("should return false on denque with items", function () {
const a = new Denque([1]);
var a = new Denque([1]);
assert(!a.isEmpty());

@@ -364,3 +364,3 @@ });

it("Should return undefined when queue is empty", function() {
const a = new Denque();
var a = new Denque();
assert(a.length === 0);

@@ -373,6 +373,6 @@ assert(a.peekFront() === void 0);

it("should return the item at the front of the denque", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
assert(a.peekFront() === 1);
let l = 5;
var l = 5;
while (l--) a.pop();

@@ -388,3 +388,3 @@

it("Should return undefined when queue is empty", function() {
const a = new Denque();
var a = new Denque();
assert(a.length === 0);

@@ -397,6 +397,6 @@ assert(a.peekBack() === void 0);

it("should return the item at the back of the denque", function () {
const a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
var a = new Denque([1, 2, 3, 4, 5, 6, 7, 8, 9]);
assert(a.peekBack() === 9);
let l = 5;
var l = 5;
while (l--) a.pop();

@@ -413,3 +413,3 @@

it("should clear the denque", function () {
const a = new Denque([1, 2, 3, 4]);
var a = new Denque([1, 2, 3, 4]);
assert(!a.isEmpty());

@@ -416,0 +416,0 @@ a.clear();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc