@behrad/mystack
Advanced tools
Comparing version 1.0.0 to 2.0.0
13
index.js
@@ -1,2 +0,4 @@ | ||
function Stack() { | ||
function Stack(limit = 10) { | ||
this.limit = limit | ||
// this.items = Array(limit) | ||
this.items = [] | ||
@@ -6,3 +8,8 @@ } | ||
Stack.prototype.push = function(item) { | ||
if (this.isFull()) { | ||
// throw new Error('Stack limit reached') | ||
return -1 | ||
} | ||
this.items[this.items.length] = item | ||
return 1 | ||
} | ||
@@ -24,2 +31,6 @@ | ||
Stack.prototype.isFull = function() { | ||
return this.size() === this.limit | ||
} | ||
module.exports = Stack |
{ | ||
"name": "@behrad/mystack", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "My Stack as a first nodejs module demonstration", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1961
5
51