[Pkg-javascript-commits] [node-dequeue] 08/12: Imported Upstream version 1.0.5
Mike Gabriel
sunweaver at debian.org
Tue Aug 19 17:49:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
sunweaver pushed a commit to branch master
in repository node-dequeue.
commit 9fc4c90a0129929377c7200bf531745c724295f2
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Aug 19 19:40:18 2014 +0200
Imported Upstream version 1.0.5
---
LICENSE | 26 ++++++++++++++++++++++++++
README.md | 6 ++++++
lib/dequeue.js | 10 ++++++++++
package.json | 2 +-
4 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..625c162
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,26 @@
+This is the 2-Clause BSD license, aka FreeBSD, copy and pasted from
+http://opensource.org/licenses/BSD-2-Clause .
+
+Copyright (c) 2012, Sean M. Egan
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
index 5a5323b..195cef3 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,12 @@ Push a value on the beginning.
### `value = deque.shift()`
Remove a value off the beginning.
+### `value = deque.last()`
+Examine the value of the end without removing it.
+
+### `value = deque.first()`
+Examine the value of the beginning without removing it.
+
### `deque.empty()`
Remove all entries. This is NOT a test for an empty dequeue; use `deque.length`
for that.
diff --git a/lib/dequeue.js b/lib/dequeue.js
index dc032ed..4f4c1d1 100644
--- a/lib/dequeue.js
+++ b/lib/dequeue.js
@@ -32,6 +32,16 @@ Dequeue.prototype.shift = function(){
return n.data
}
+Dequeue.prototype.last = function(){
+ if (this.head.prev === this.head) return
+ return this.head.prev.data
+}
+
+Dequeue.prototype.first = function(){
+ if (this.head.next === this.head) return
+ return this.head.next.data
+}
+
Dequeue.prototype.empty = function(){
if (this.length === 0 ) return
diff --git a/package.json b/package.json
index c012500..8da51d9 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name" : "dequeue"
, "main" : "./lib/index.js"
-, "version" : "1.0.3"
+, "version" : "1.0.5"
, "description" : "A simple double ended queue datastructure"
, "keywords" : ["datastructure", "queue", "double ended queue", "fifo", "FIFO", "linked list"]
, "homepage" : "https://github.com/lleo/node-dequeue"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-dequeue.git
More information about the Pkg-javascript-commits
mailing list