Comparing version 0.2.1 to 0.2.2
@@ -7,3 +7,3 @@ ### Changelog | ||
#### 0.2.0 | ||
#### 0.2.1 | ||
@@ -15,7 +15,9 @@ > 28 March 2020 | ||
- Create ci-run-tests.yml [`#2`](https://github.com/sagar-gavhane/rahome/pull/2) | ||
- 👌 IMPROVE: remove, removeFirst, removeLast method add and lodash removed [`92e25d8`](https://github.com/sagar-gavhane/rahome/commit/92e25d8b79d98f0b32234537cf74c96388e9d246) | ||
- 📦 NEW: Stack [`d1f12b2`](https://github.com/sagar-gavhane/rahome/commit/d1f12b2cfa0746401953c7017ccf9ed41ade95f3) | ||
- LinkedList initial draft [`5e594d5`](https://github.com/sagar-gavhane/rahome/commit/5e594d5fc4228a9ad78f75fdc7115affe765d0e8) | ||
- 👌 IMPROVE: remove, removeFirst, removeLast method add and lodash removed [`4e733d1`](https://github.com/sagar-gavhane/rahome/commit/4e733d1491a20d0cfc8386704c30584d17c4c0ba) | ||
- 📦 NEW: Stack abstract data structure add [`8b4e741`](https://github.com/sagar-gavhane/rahome/commit/8b4e741d3a12b4c0c050e994a78543da021ecab7) | ||
- first commit [`5f781f5`](https://github.com/sagar-gavhane/rahome/commit/5f781f5917783bd3b6745aa866894e64c9049918) | ||
- PR comments resolved [`7141aef`](https://github.com/sagar-gavhane/rahome/commit/7141aefc654151073177c6ba2a4bf33991ba6ea5) | ||
- 🐞 FIX: PR comments resolved [`40c9dd4`](https://github.com/sagar-gavhane/rahome/commit/40c9dd439c142c3118ad5a8f68c72cfb9518a114) | ||
- 📖 DOC: Changelog [`f14dc45`](https://github.com/sagar-gavhane/rahome/commit/f14dc45d97b7f64641f389e5894806a2666496e6) | ||
@@ -25,2 +27,5 @@ - remove test suite [`0de5867`](https://github.com/sagar-gavhane/rahome/commit/0de58671ee1eb79b4ed17571e0758c2bbeabc340) | ||
- add sonar-project.properties [`b6fabe0`](https://github.com/sagar-gavhane/rahome/commit/b6fabe08e587e365ff26d2cf732f6cb523c861e2) | ||
- 📖 DOC: Changelog [`bc86831`](https://github.com/sagar-gavhane/rahome/commit/bc86831688c7dd844db77199aef3b036f748475e) | ||
- 📖 DOC: Changelog [`7708289`](https://github.com/sagar-gavhane/rahome/commit/770828952ff1ac5aee38645b651dfbde6a0e502d) | ||
- 👌 IMPROVE: remove, removeFirst, removeLast method add and lodash removed [`92e25d8`](https://github.com/sagar-gavhane/rahome/commit/92e25d8b79d98f0b32234537cf74c96388e9d246) | ||
- update pkg.json [`25f06c7`](https://github.com/sagar-gavhane/rahome/commit/25f06c7a8015b3ef1c5fa40895ef8280b4d7f66b) |
import LinkedList from './data-structure/LinkedList'; | ||
export { LinkedList }; | ||
import Stack from './data-structure/Stack'; | ||
export { LinkedList, Stack }; |
@@ -321,3 +321,76 @@ 'use strict'; | ||
var Stack = /*#__PURE__*/function () { | ||
function Stack() { | ||
this.storage = []; | ||
} | ||
/** | ||
* Tests if this stack is empty. | ||
* | ||
* @returns {boolean} true if and only if this stack contains no items; false otherwise. | ||
* @memberof Stack | ||
*/ | ||
var _proto = Stack.prototype; | ||
_proto.isEmpty = function isEmpty() { | ||
return this.storage.length === 0; | ||
} | ||
/** | ||
* Removes the object at the top of this stack and returns that object as the value of this function. | ||
* | ||
* @returns {*} The element at the top of this stack. | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.pop = function pop() { | ||
if (this.isEmpty()) { | ||
var message = "EmptyStackException: Trying to perform pop operation on empty stack"; | ||
throw new Error(message); | ||
} | ||
return this.storage.pop(); | ||
} | ||
/** | ||
* Pushes an element onto the top of this stack. | ||
* | ||
* @param {*} element element to be pushed onto this stack. | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.push = function push(element) { | ||
this.storage.push(element); | ||
} | ||
/** | ||
* Returns an array representation of stack | ||
* | ||
* @returns {Array<any>} | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.toArray = function toArray() { | ||
return this.storage; | ||
} | ||
/** | ||
* Returns string representation of stack | ||
* | ||
* @returns {Array<any>} | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.toString = function toString() { | ||
return this.storage.map(function (el) { | ||
return JSON.stringify(el); | ||
}).toString(); | ||
}; | ||
return Stack; | ||
}(); | ||
exports.LinkedList = LinkedList; | ||
exports.Stack = Stack; | ||
//# sourceMappingURL=rahome.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(t,i){void 0===i&&(i=null),this.value=t,this.next=i};t.prototype.toString=function(){return"object"==typeof this.value&&null!==this.value?JSON.stringify(this.value):""+this.value};var i=function(t,i){return JSON.stringify(t)===JSON.stringify(i)};exports.LinkedList=function(){function n(){this.head=null,this.tail=null,this.numberOfNodes=0}var e=n.prototype;return e.add=function(i,n){if(void 0===n&&(n=null),n&&n>this.numberOfNodes+1)throw new Error("invalid position");if(null===n)return this.isEmpty()?this.addFirst(i):this.addLast(i),this;if(0===n)return this.addFirst(i),this;for(var e=this.head,l=0,r=new t(i,null);null!==n&&l<n-1;){var u;e=(null===(u=e)||void 0===u?void 0:u.next)||null,l++}return r.next=e||null,e=r,this.numberOfNodes++,null!==this.head&&(this.head.next=e||null),this},e.addFirst=function(i){var n=new t(i,this.head);return this.head=n,this.numberOfNodes++,this.tail||(this.tail=n),this},e.addLast=function(i){var n=new t(i);return this.isEmpty()&&(this.head=n,this.tail=n),null!==this.tail&&(this.tail.next=n,this.tail=n),this.numberOfNodes++,this},e.clear=function(){this.head=null,this.tail=null,this.numberOfNodes=0},e.contains=function(t){if(this.isEmpty())return!1;for(var n=this.head;n;){if(i(n.value,t))return!0;n=n.next}return!1},e.isEmpty=function(){return null===this.head},e.remove=function(t){var n;if(null===this.head)return null;var e=null;i(this.head.value,t)&&(e=this.head,this.head=this.head.next);for(var l=this.head;l&&null!==(null===(r=l)||void 0===r?void 0:r.next);){var r,u,s,h,a;i(null===(u=l)||void 0===u?void 0:u.next.value,t)?(e=null===(s=l)||void 0===s?void 0:s.next,l.next=null===(h=l)||void 0===h?void 0:h.next.next):l=null===(a=l)||void 0===a?void 0:a.next}return i(null===(n=this.tail)||void 0===n?void 0:n.value,t)&&(this.tail=l),e},e.removeFirst=function(){if(null===this.head)return null;var t=this.head;return this.head=this.head.next,t.next=null,t},e.removeLast=function(){if(null===this.head)return null;var t=null;if(this.head===this.tail)return t=this.head,this.head=null,this.tail=null,t;for(var i=this.head;null!==(null===(n=i)||void 0===n?void 0:n.next);){var n,e,l;(null===(e=i)||void 0===e?void 0:e.next.next)?i=i.next:(null===(l=i)||void 0===l?void 0:l.next)&&(t=i.next,i.next=null)}return this.tail=i,t},e.size=function(){return this.numberOfNodes},e.toArray=function(){for(var t=[],i=this.head;i;)t.push(i),i=i.next;return t},e.toString=function(){return this.toArray().map((function(t){return t.toString()})).toString()},n}(); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(t,i){void 0===i&&(i=null),this.value=t,this.next=i};t.prototype.toString=function(){return"object"==typeof this.value&&null!==this.value?JSON.stringify(this.value):""+this.value};var i=function(t,i){return JSON.stringify(t)===JSON.stringify(i)},n=function(){function n(){this.head=null,this.tail=null,this.numberOfNodes=0}var e=n.prototype;return e.add=function(i,n){if(void 0===n&&(n=null),n&&n>this.numberOfNodes+1)throw new Error("invalid position");if(null===n)return this.isEmpty()?this.addFirst(i):this.addLast(i),this;if(0===n)return this.addFirst(i),this;for(var e=this.head,r=0,u=new t(i,null);null!==n&&r<n-1;){var s;e=(null===(s=e)||void 0===s?void 0:s.next)||null,r++}return u.next=e||null,e=u,this.numberOfNodes++,null!==this.head&&(this.head.next=e||null),this},e.addFirst=function(i){var n=new t(i,this.head);return this.head=n,this.numberOfNodes++,this.tail||(this.tail=n),this},e.addLast=function(i){var n=new t(i);return this.isEmpty()&&(this.head=n,this.tail=n),null!==this.tail&&(this.tail.next=n,this.tail=n),this.numberOfNodes++,this},e.clear=function(){this.head=null,this.tail=null,this.numberOfNodes=0},e.contains=function(t){if(this.isEmpty())return!1;for(var n=this.head;n;){if(i(n.value,t))return!0;n=n.next}return!1},e.isEmpty=function(){return null===this.head},e.remove=function(t){var n;if(null===this.head)return null;var e=null;i(this.head.value,t)&&(e=this.head,this.head=this.head.next);for(var r=this.head;r&&null!==(null===(u=r)||void 0===u?void 0:u.next);){var u,s,l,o,h;i(null===(s=r)||void 0===s?void 0:s.next.value,t)?(e=null===(l=r)||void 0===l?void 0:l.next,r.next=null===(o=r)||void 0===o?void 0:o.next.next):r=null===(h=r)||void 0===h?void 0:h.next}return i(null===(n=this.tail)||void 0===n?void 0:n.value,t)&&(this.tail=r),e},e.removeFirst=function(){if(null===this.head)return null;var t=this.head;return this.head=this.head.next,t.next=null,t},e.removeLast=function(){if(null===this.head)return null;var t=null;if(this.head===this.tail)return t=this.head,this.head=null,this.tail=null,t;for(var i=this.head;null!==(null===(n=i)||void 0===n?void 0:n.next);){var n,e,r;(null===(e=i)||void 0===e?void 0:e.next.next)?i=i.next:(null===(r=i)||void 0===r?void 0:r.next)&&(t=i.next,i.next=null)}return this.tail=i,t},e.size=function(){return this.numberOfNodes},e.toArray=function(){for(var t=[],i=this.head;i;)t.push(i),i=i.next;return t},e.toString=function(){return this.toArray().map((function(t){return t.toString()})).toString()},n}(),e=function(){function t(){this.storage=[]}var i=t.prototype;return i.isEmpty=function(){return 0===this.storage.length},i.pop=function(){if(this.isEmpty())throw new Error("EmptyStackException: Trying to perform pop operation on empty stack");return this.storage.pop()},i.push=function(t){this.storage.push(t)},i.toArray=function(){return this.storage},i.toString=function(){return this.storage.map((function(t){return JSON.stringify(t)})).toString()},t}();exports.LinkedList=n,exports.Stack=e; | ||
//# sourceMappingURL=rahome.cjs.production.min.js.map |
@@ -317,3 +317,75 @@ var Node = function Node(value, next) { | ||
export { LinkedList }; | ||
var Stack = /*#__PURE__*/function () { | ||
function Stack() { | ||
this.storage = []; | ||
} | ||
/** | ||
* Tests if this stack is empty. | ||
* | ||
* @returns {boolean} true if and only if this stack contains no items; false otherwise. | ||
* @memberof Stack | ||
*/ | ||
var _proto = Stack.prototype; | ||
_proto.isEmpty = function isEmpty() { | ||
return this.storage.length === 0; | ||
} | ||
/** | ||
* Removes the object at the top of this stack and returns that object as the value of this function. | ||
* | ||
* @returns {*} The element at the top of this stack. | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.pop = function pop() { | ||
if (this.isEmpty()) { | ||
var message = "EmptyStackException: Trying to perform pop operation on empty stack"; | ||
throw new Error(message); | ||
} | ||
return this.storage.pop(); | ||
} | ||
/** | ||
* Pushes an element onto the top of this stack. | ||
* | ||
* @param {*} element element to be pushed onto this stack. | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.push = function push(element) { | ||
this.storage.push(element); | ||
} | ||
/** | ||
* Returns an array representation of stack | ||
* | ||
* @returns {Array<any>} | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.toArray = function toArray() { | ||
return this.storage; | ||
} | ||
/** | ||
* Returns string representation of stack | ||
* | ||
* @returns {Array<any>} | ||
* @memberof Stack | ||
*/ | ||
; | ||
_proto.toString = function toString() { | ||
return this.storage.map(function (el) { | ||
return JSON.stringify(el); | ||
}).toString(); | ||
}; | ||
return Stack; | ||
}(); | ||
export { LinkedList, Stack }; | ||
//# sourceMappingURL=rahome.esm.js.map |
{ | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
68884
19
813