Commit 5b5df7d0 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Revert "Merge branch 'cherry-pick-5b932c11' into 'testing'"

This reverts merge request !169
parent 4806fefb
1 merge request!170Revert "Merge branch 'cherry-pick-5b932c11' into 'testing'"
Showing with 44 additions and 21 deletions
+44 -21
declare class Denque<T = any> {
length: number;
constructor();
constructor(array: T[]);
constructor(array: T[], options: IDenqueOptions);
push(item: T): number;
unshift(item: T): number;
pop(): T | undefined;
removeBack(): T | undefined;
shift(): T | undefined;
peekBack(): T | undefined;
peekFront(): T | undefined;
peekAt(index: number): T | undefined;
get(index: number): T | undefined;
remove(index: number, count: number): T[];
removeOne(index: number): T | undefined;
splice(index: number, count: number, ...item: T[]): T[] | undefined;
isEmpty(): boolean;
clear(): void;
size(): number;
toString(): string;
toArray(): T[];
length: number;
toArray(): T[];
}
interface IDenqueOptions {
......
......@@ -17,7 +17,7 @@ function Denque(array, options) {
}
/**
* -------------
* --------------
* PUBLIC API
* -------------
*/
......@@ -102,7 +102,7 @@ Denque.prototype.size = function size() {
* @param item
*/
Denque.prototype.unshift = function unshift(item) {
if (item === undefined) return this.size();
if (arguments.length === 0) return this.size();
var len = this._list.length;
this._head = (this._head - 1 + len) & this._capacityMask;
this._list[this._head] = item;
......@@ -132,7 +132,7 @@ Denque.prototype.shift = function shift() {
* @param item
*/
Denque.prototype.push = function push(item) {
if (item === undefined) return this.size();
if (arguments.length === 0) return this.size();
var tail = this._tail;
this._list[tail] = item;
this._tail = (tail + 1) & this._capacityMask;
......@@ -190,7 +190,7 @@ Denque.prototype.removeOne = function removeOne(index) {
this._head = (this._head + 1 + len) & this._capacityMask;
} else {
for (k = size - 1 - index; k > 0; k--) {
this._list[i] = this._list[i = ( i + 1 + len) & this._capacityMask];
this._list[i] = this._list[i = (i + 1 + len) & this._capacityMask];
}
this._list[i] = void 0;
this._tail = (this._tail - 1 + len) & this._capacityMask;
......@@ -426,7 +426,7 @@ Denque.prototype._growArray = function _growArray() {
// head is at 0 and array is now full, safe to extend
this._tail = this._list.length;
this._list.length *= 2;
this._list.length <<= 1;
this._capacityMask = (this._capacityMask << 1) | 1;
};
......
{
"name": "denque",
"version": "1.5.0",
"description": "The fastest javascript implementation of a double-ended queue. Maintains compatability with deque.",
"version": "2.0.1",
"description": "The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. Maintains compatability with deque.",
"main": "index.js",
"engines": {
"node": ">=0.10"
......@@ -43,10 +43,10 @@
"bugs": {
"url": "https://github.com/invertase/denque/issues"
},
"homepage": "https://github.com/invertase/denque#readme",
"homepage": "https://docs.page/invertase/denque",
"devDependencies": {
"benchmark": "^2.1.4",
"coveralls": "^2.13.3",
"codecov": "^3.8.3",
"double-ended-queue": "^2.1.0-0",
"istanbul": "^0.4.5",
"mocha": "^3.5.3",
......
2.0.0 / 2018-10-26
==================
* Drop support for Node.js 0.6
* Replace internal `eval` usage with `Function` constructor
* Use instance methods on `process` to check for listeners
1.1.2 / 2018-01-11
==================
......
(The MIT License)
Copyright (c) 2014-2017 Douglas Christopher Wilson
Copyright (c) 2014-2018 Douglas Christopher Wilson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
......
......@@ -267,14 +267,14 @@ deprecate.property(exports, 'oldprop', 'oldprop >= 0.10')
[MIT](LICENSE)
[npm-version-image]: https://img.shields.io/npm/v/depd.svg
[npm-downloads-image]: https://img.shields.io/npm/dm/depd.svg
[npm-url]: https://npmjs.org/package/depd
[travis-image]: https://img.shields.io/travis/dougwilson/nodejs-depd/master.svg?label=linux
[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/nodejs-depd/master.svg?label=windows
[appveyor-image]: https://badgen.net/appveyor/ci/dougwilson/nodejs-depd/master?label=windows
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd
[coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd/master.svg
[coveralls-image]: https://badgen.net/coveralls/c/github/dougwilson/nodejs-depd/master
[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master
[node-image]: https://img.shields.io/node/v/depd.svg
[node-image]: https://badgen.net/npm/node/depd
[node-url]: https://nodejs.org/en/download/
[npm-downloads-image]: https://badgen.net/npm/dm/depd
[npm-url]: https://npmjs.org/package/depd
[npm-version-image]: https://badgen.net/npm/v/depd
[travis-image]: https://badgen.net/travis/dougwilson/nodejs-depd/master?label=linux
[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment