Comparing version 0.2.5 to 0.2.6
@@ -5,2 +5,6 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var isEqual = _interopDefault(require('fast-deep-equal')); | ||
var id = 0; | ||
@@ -38,6 +42,2 @@ | ||
var isEqual = function isEqual(value, other) { | ||
return JSON.stringify(value) === JSON.stringify(other); | ||
}; | ||
var LinkedList = /*#__PURE__*/function () { | ||
@@ -97,15 +97,16 @@ function LinkedList() { | ||
while (position !== null && currentPosition < position - 1) { | ||
var _current; | ||
while (((_current = current) === null || _current === void 0 ? void 0 : _current.next) !== null && position !== null && currentPosition < position - 1) { | ||
var _current, _current2; | ||
current = ((_current = current) === null || _current === void 0 ? void 0 : _current.next) || null; | ||
current = ((_current2 = current) === null || _current2 === void 0 ? void 0 : _current2.next) || null; | ||
currentPosition++; | ||
} | ||
node.next = current || null; | ||
current = node; | ||
if (current) { | ||
var temp = current.next; | ||
current.next = node; | ||
current.next.next = temp; | ||
} | ||
_classPrivateFieldLooseBase(this, _numberOfNodes)[_numberOfNodes]++; | ||
/* istanbul ignore else */ | ||
if (_classPrivateFieldLooseBase(this, _head)[_head] !== null) _classPrivateFieldLooseBase(this, _head)[_head].next = current || null; | ||
return this; | ||
@@ -229,14 +230,14 @@ } | ||
while (current && ((_current2 = current) === null || _current2 === void 0 ? void 0 : _current2.next) !== null) { | ||
var _current2, _current3; | ||
while (current && ((_current3 = current) === null || _current3 === void 0 ? void 0 : _current3.next) !== null) { | ||
var _current3, _current4; | ||
if (isEqual((_current3 = current) === null || _current3 === void 0 ? void 0 : _current3.next.value, element)) { | ||
var _current4, _current5; | ||
if (isEqual((_current4 = current) === null || _current4 === void 0 ? void 0 : _current4.next.value, element)) { | ||
var _current5, _current6; | ||
deletedNode = (_current4 = current) === null || _current4 === void 0 ? void 0 : _current4.next; | ||
current.next = (_current5 = current) === null || _current5 === void 0 ? void 0 : _current5.next.next; | ||
deletedNode = (_current5 = current) === null || _current5 === void 0 ? void 0 : _current5.next; | ||
current.next = (_current6 = current) === null || _current6 === void 0 ? void 0 : _current6.next.next; | ||
} else { | ||
var _current6; | ||
var _current7; | ||
current = (_current6 = current) === null || _current6 === void 0 ? void 0 : _current6.next; | ||
current = (_current7 = current) === null || _current7 === void 0 ? void 0 : _current7.next; | ||
} | ||
@@ -294,10 +295,10 @@ } | ||
while (((_current7 = current) === null || _current7 === void 0 ? void 0 : _current7.next) !== null) { | ||
var _current7, _current8; | ||
while (((_current8 = current) === null || _current8 === void 0 ? void 0 : _current8.next) !== null) { | ||
var _current8, _current9; | ||
if (!((_current8 = current) === null || _current8 === void 0 ? void 0 : _current8.next.next)) { | ||
var _current9; | ||
if (!((_current9 = current) === null || _current9 === void 0 ? void 0 : _current9.next.next)) { | ||
var _current10; | ||
/* istanbul ignore else */ | ||
if ((_current9 = current) === null || _current9 === void 0 ? void 0 : _current9.next) { | ||
if ((_current10 = current) === null || _current10 === void 0 ? void 0 : _current10.next) { | ||
deletedNode = current.next; | ||
@@ -304,0 +305,0 @@ current.next = null; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=0;function i(i){return"__private_"+t+++"_"+i}function n(t,i){if(!Object.prototype.hasOwnProperty.call(t,i))throw new TypeError("attempted to use private field on non-instance");return t}var r=function(t,i){void 0===i&&(i=null),this.value=t,this.next=i};r.prototype.toString=function(){return"object"==typeof this.value&&null!==this.value?JSON.stringify(this.value):""+this.value};var e=function(t,i){return JSON.stringify(t)===JSON.stringify(i)},s=function(){function t(){Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,o,{writable:!0,value:void 0}),Object.defineProperty(this,h,{writable:!0,value:void 0}),n(this,u)[u]=null,n(this,o)[o]=null,n(this,h)[h]=0}var i=t.prototype;return i.add=function(t,i){if(void 0===i&&(i=null),i&&i>n(this,h)[h]+1)throw new Error("invalid position");if(null===i)return this.isEmpty()?this.addFirst(t):this.addLast(t),this;if(0===i)return this.addFirst(t),this;for(var e=n(this,u)[u],s=0,o=new r(t,null);null!==i&&s<i-1;){var l;e=(null===(l=e)||void 0===l?void 0:l.next)||null,s++}return o.next=e||null,e=o,n(this,h)[h]++,null!==n(this,u)[u]&&(n(this,u)[u].next=e||null),this},i.addFirst=function(t){var i=new r(t,n(this,u)[u]);return n(this,u)[u]=i,n(this,h)[h]++,n(this,o)[o]||(n(this,o)[o]=i),this},i.addLast=function(t){var i=new r(t);return this.isEmpty()&&(n(this,u)[u]=i,n(this,o)[o]=i),null!==n(this,o)[o]&&(n(this,o)[o].next=i,n(this,o)[o]=i),n(this,h)[h]++,this},i.clear=function(){n(this,u)[u]=null,n(this,o)[o]=null,n(this,h)[h]=0},i.contains=function(t){if(this.isEmpty())return!1;for(var i=n(this,u)[u];i;){if(e(i.value,t))return!0;i=i.next}return!1},i.isEmpty=function(){return null===n(this,u)[u]},i.remove=function(t){var i;if(null===n(this,u)[u])return null;var r=null;e(n(this,u)[u].value,t)&&(r=n(this,u)[u],n(this,u)[u]=n(this,u)[u].next);for(var s=n(this,u)[u];s&&null!==(null===(h=s)||void 0===h?void 0:h.next);){var h,l,a,f,v;e(null===(l=s)||void 0===l?void 0:l.next.value,t)?(r=null===(a=s)||void 0===a?void 0:a.next,s.next=null===(f=s)||void 0===f?void 0:f.next.next):s=null===(v=s)||void 0===v?void 0:v.next}return e(null===(i=n(this,o)[o])||void 0===i?void 0:i.value,t)&&(n(this,o)[o]=s),r},i.removeFirst=function(){if(null===n(this,u)[u])return null;var t=n(this,u)[u];return n(this,u)[u]=n(this,u)[u].next,t.next=null,t},i.removeLast=function(){if(null===n(this,u)[u])return null;var t=null;if(n(this,u)[u]===n(this,o)[o])return t=n(this,u)[u],n(this,u)[u]=null,n(this,o)[o]=null,t;for(var i=n(this,u)[u];null!==(null===(r=i)||void 0===r?void 0:r.next);){var r,e,s;(null===(e=i)||void 0===e?void 0:e.next.next)?i=i.next:(null===(s=i)||void 0===s?void 0:s.next)&&(t=i.next,i.next=null)}return n(this,o)[o]=i,t},i.size=function(){return n(this,h)[h]},i.toArray=function(){for(var t=[],i=n(this,u)[u];i;)t.push(i),i=i.next;return t},i.toString=function(){return this.toArray().map((function(t){return t.toString()})).toString()},t}(),u=i("head"),o=i("tail"),h=i("numberOfNodes"),l=function(){function t(){Object.defineProperty(this,a,{writable:!0,value:void 0}),n(this,a)[a]=[]}var i=t.prototype;return i.isEmpty=function(){return 0===n(this,a)[a].length},i.pop=function(){if(this.isEmpty())throw new Error("EmptyStackException: Trying to perform pop operation on empty stack");return n(this,a)[a].pop()},i.push=function(t){n(this,a)[a].push(t)},i.toArray=function(){return n(this,a)[a]},i.toString=function(){return n(this,a)[a].map((function(t){return JSON.stringify(t)})).toString()},t}(),a=i("storage"),f=function(){function t(t){void 0===t&&(t=100),Object.defineProperty(this,v,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,y,{writable:!0,value:void 0}),n(this,v)[v]=[],n(this,c)[c]=0,n(this,d)[d]=99,n(this,p)[p]=0,n(this,y)[y]=100;var i=Math.abs(t);n(this,y)[y]=i>0?i:100,n(this,v)[v]=new Array(n(this,y)[y]).fill(null),n(this,d)[d]=n(this,y)[y]-1}var i=t.prototype;return i.dequeue=function(){if(this.isEmpty())return null;var t=n(this,v)[v][n(this,c)[c]];return n(this,c)[c]=(n(this,c)[c]+1)%n(this,y)[y],n(this,p)[p]--,t},i.enqueue=function(t){if(this.isFull())throw new Error("IllegalStateException: There is no space available for current element");return n(this,d)[d]=(n(this,d)[d]+1)%n(this,y)[y],n(this,v)[v][n(this,d)[d]]=t,n(this,p)[p]++,!0},i.isEmpty=function(){return 0===n(this,p)[p]},i.isFull=function(){return n(this,p)[p]===n(this,y)[y]},i.peek=function(){return n(this,v)[v][n(this,c)[c]]},i.toArray=function(){return n(this,v)[v]},i.toString=function(){return n(this,v)[v].map((function(t){return JSON.stringify(t)})).toString()},t}(),v=i("storage"),c=i("front"),d=i("rear"),p=i("size"),y=i("capacity"),x=function(){function t(){Object.defineProperty(this,b,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),n(this,m)[m]={},n(this,b)[b]=new Map}var i=t.prototype;return i.hashCode=function(t){var i,n;for(i=0,n=0;i<(""+t).length;i++)n=Math.imul(31,n)+(""+t).charCodeAt(i)|0;return n},i.get=function(t){var i=this.hashCode(t);return n(this,b)[b].get(i)},i.set=function(t,i){var r=this.hashCode(t);n(this,m)[m][r]=t,n(this,b)[b].set(r,i)},i.delete=function(t){var i=this.hashCode(t);delete n(this,m)[m][i],n(this,b)[b].delete(i)},i.contains=function(t){var i=this.hashCode(t);return n(this,b)[b].has(i)},i.keys=function(){return this.toArray().map((function(t){return t[0]}))},i.clear=function(){n(this,m)[m]={},n(this,b)[b].clear()},i.size=function(){return n(this,b)[b].size},i.isEmpty=function(){return 0===this.size()},i.toArray=function(){var t=this;return Array.from(n(this,b)[b]).map((function(i){var r=i[0],e=i[1];return[n(t,m)[m][r],e]}))},i.toString=function(){var t=this,i=[];return n(this,b)[b].forEach((function(r,e){var s=n(t,m)[m][e];i.push(s+"="+JSON.stringify(r))})),i.join(",")},t}(),b=i("buckets"),m=i("keys");exports.HashTable=x,exports.LinkedList=s,exports.Queue=f,exports.Stack=l; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,i=(t=require("fast-deep-equal"))&&"object"==typeof t&&"default"in t?t.default:t,n=0;function e(t){return"__private_"+n+++"_"+t}function r(t,i){if(!Object.prototype.hasOwnProperty.call(t,i))throw new TypeError("attempted to use private field on non-instance");return t}var s=function(t,i){void 0===i&&(i=null),this.value=t,this.next=i};s.prototype.toString=function(){return"object"==typeof this.value&&null!==this.value?JSON.stringify(this.value):""+this.value};var u=function(){function t(){Object.defineProperty(this,o,{writable:!0,value:void 0}),Object.defineProperty(this,h,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),r(this,o)[o]=null,r(this,h)[h]=null,r(this,l)[l]=0}var n=t.prototype;return n.add=function(t,i){if(void 0===i&&(i=null),i&&i>r(this,l)[l]+1)throw new Error("invalid position");if(null===i)return this.isEmpty()?this.addFirst(t):this.addLast(t),this;if(0===i)return this.addFirst(t),this;for(var n=r(this,o)[o],e=0,u=new s(t,null);null!==(null===(h=n)||void 0===h?void 0:h.next)&&null!==i&&e<i-1;){var h,a;n=(null===(a=n)||void 0===a?void 0:a.next)||null,e++}if(n){var f=n.next;n.next=u,n.next.next=f}return r(this,l)[l]++,this},n.addFirst=function(t){var i=new s(t,r(this,o)[o]);return r(this,o)[o]=i,r(this,l)[l]++,r(this,h)[h]||(r(this,h)[h]=i),this},n.addLast=function(t){var i=new s(t);return this.isEmpty()&&(r(this,o)[o]=i,r(this,h)[h]=i),null!==r(this,h)[h]&&(r(this,h)[h].next=i,r(this,h)[h]=i),r(this,l)[l]++,this},n.clear=function(){r(this,o)[o]=null,r(this,h)[h]=null,r(this,l)[l]=0},n.contains=function(t){if(this.isEmpty())return!1;for(var n=r(this,o)[o];n;){if(i(n.value,t))return!0;n=n.next}return!1},n.isEmpty=function(){return null===r(this,o)[o]},n.remove=function(t){var n;if(null===r(this,o)[o])return null;var e=null;i(r(this,o)[o].value,t)&&(e=r(this,o)[o],r(this,o)[o]=r(this,o)[o].next);for(var s=r(this,o)[o];s&&null!==(null===(u=s)||void 0===u?void 0:u.next);){var u,l,a,f,v;i(null===(l=s)||void 0===l?void 0:l.next.value,t)?(e=null===(a=s)||void 0===a?void 0:a.next,s.next=null===(f=s)||void 0===f?void 0:f.next.next):s=null===(v=s)||void 0===v?void 0:v.next}return i(null===(n=r(this,h)[h])||void 0===n?void 0:n.value,t)&&(r(this,h)[h]=s),e},n.removeFirst=function(){if(null===r(this,o)[o])return null;var t=r(this,o)[o];return r(this,o)[o]=r(this,o)[o].next,t.next=null,t},n.removeLast=function(){if(null===r(this,o)[o])return null;var t=null;if(r(this,o)[o]===r(this,h)[h])return t=r(this,o)[o],r(this,o)[o]=null,r(this,h)[h]=null,t;for(var i=r(this,o)[o];null!==(null===(n=i)||void 0===n?void 0:n.next);){var n,e,s;(null===(e=i)||void 0===e?void 0:e.next.next)?i=i.next:(null===(s=i)||void 0===s?void 0:s.next)&&(t=i.next,i.next=null)}return r(this,h)[h]=i,t},n.size=function(){return r(this,l)[l]},n.toArray=function(){for(var t=[],i=r(this,o)[o];i;)t.push(i),i=i.next;return t},n.toString=function(){return this.toArray().map((function(t){return t.toString()})).toString()},t}(),o=e("head"),h=e("tail"),l=e("numberOfNodes"),a=function(){function t(){Object.defineProperty(this,f,{writable:!0,value:void 0}),r(this,f)[f]=[]}var i=t.prototype;return i.isEmpty=function(){return 0===r(this,f)[f].length},i.pop=function(){if(this.isEmpty())throw new Error("EmptyStackException: Trying to perform pop operation on empty stack");return r(this,f)[f].pop()},i.push=function(t){r(this,f)[f].push(t)},i.toArray=function(){return r(this,f)[f]},i.toString=function(){return r(this,f)[f].map((function(t){return JSON.stringify(t)})).toString()},t}(),f=e("storage"),v=function(){function t(t){void 0===t&&(t=100),Object.defineProperty(this,c,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,y,{writable:!0,value:void 0}),Object.defineProperty(this,x,{writable:!0,value:void 0}),r(this,c)[c]=[],r(this,d)[d]=0,r(this,p)[p]=99,r(this,y)[y]=0,r(this,x)[x]=100;var i=Math.abs(t);r(this,x)[x]=i>0?i:100,r(this,c)[c]=new Array(r(this,x)[x]).fill(null),r(this,p)[p]=r(this,x)[x]-1}var i=t.prototype;return i.dequeue=function(){if(this.isEmpty())return null;var t=r(this,c)[c][r(this,d)[d]];return r(this,d)[d]=(r(this,d)[d]+1)%r(this,x)[x],r(this,y)[y]--,t},i.enqueue=function(t){if(this.isFull())throw new Error("IllegalStateException: There is no space available for current element");return r(this,p)[p]=(r(this,p)[p]+1)%r(this,x)[x],r(this,c)[c][r(this,p)[p]]=t,r(this,y)[y]++,!0},i.isEmpty=function(){return 0===r(this,y)[y]},i.isFull=function(){return r(this,y)[y]===r(this,x)[x]},i.peek=function(){return r(this,c)[c][r(this,d)[d]]},i.toArray=function(){return r(this,c)[c]},i.toString=function(){return r(this,c)[c].map((function(t){return JSON.stringify(t)})).toString()},t}(),c=e("storage"),d=e("front"),p=e("rear"),y=e("size"),x=e("capacity"),b=function(){function t(){Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,w,{writable:!0,value:void 0}),r(this,w)[w]={},r(this,m)[m]=new Map}var i=t.prototype;return i.hashCode=function(t){var i,n;for(i=0,n=0;i<(""+t).length;i++)n=Math.imul(31,n)+(""+t).charCodeAt(i)|0;return n},i.get=function(t){var i=this.hashCode(t);return r(this,m)[m].get(i)},i.set=function(t,i){var n=this.hashCode(t);r(this,w)[w][n]=t,r(this,m)[m].set(n,i)},i.delete=function(t){var i=this.hashCode(t);delete r(this,w)[w][i],r(this,m)[m].delete(i)},i.contains=function(t){var i=this.hashCode(t);return r(this,m)[m].has(i)},i.keys=function(){return this.toArray().map((function(t){return t[0]}))},i.clear=function(){r(this,w)[w]={},r(this,m)[m].clear()},i.size=function(){return r(this,m)[m].size},i.isEmpty=function(){return 0===this.size()},i.toArray=function(){var t=this;return Array.from(r(this,m)[m]).map((function(i){var n=i[0],e=i[1];return[r(t,w)[w][n],e]}))},i.toString=function(){var t=this,i=[];return r(this,m)[m].forEach((function(n,e){var s=r(t,w)[w][e];i.push(s+"="+JSON.stringify(n))})),i.join(",")},t}(),m=e("buckets"),w=e("keys");exports.HashTable=b,exports.LinkedList=u,exports.Queue=v,exports.Stack=a; | ||
//# sourceMappingURL=rahome.cjs.production.min.js.map |
@@ -0,1 +1,3 @@ | ||
import isEqual from 'fast-deep-equal'; | ||
var id = 0; | ||
@@ -33,6 +35,2 @@ | ||
var isEqual = function isEqual(value, other) { | ||
return JSON.stringify(value) === JSON.stringify(other); | ||
}; | ||
var LinkedList = /*#__PURE__*/function () { | ||
@@ -92,15 +90,16 @@ function LinkedList() { | ||
while (position !== null && currentPosition < position - 1) { | ||
var _current; | ||
while (((_current = current) === null || _current === void 0 ? void 0 : _current.next) !== null && position !== null && currentPosition < position - 1) { | ||
var _current, _current2; | ||
current = ((_current = current) === null || _current === void 0 ? void 0 : _current.next) || null; | ||
current = ((_current2 = current) === null || _current2 === void 0 ? void 0 : _current2.next) || null; | ||
currentPosition++; | ||
} | ||
node.next = current || null; | ||
current = node; | ||
if (current) { | ||
var temp = current.next; | ||
current.next = node; | ||
current.next.next = temp; | ||
} | ||
_classPrivateFieldLooseBase(this, _numberOfNodes)[_numberOfNodes]++; | ||
/* istanbul ignore else */ | ||
if (_classPrivateFieldLooseBase(this, _head)[_head] !== null) _classPrivateFieldLooseBase(this, _head)[_head].next = current || null; | ||
return this; | ||
@@ -224,14 +223,14 @@ } | ||
while (current && ((_current2 = current) === null || _current2 === void 0 ? void 0 : _current2.next) !== null) { | ||
var _current2, _current3; | ||
while (current && ((_current3 = current) === null || _current3 === void 0 ? void 0 : _current3.next) !== null) { | ||
var _current3, _current4; | ||
if (isEqual((_current3 = current) === null || _current3 === void 0 ? void 0 : _current3.next.value, element)) { | ||
var _current4, _current5; | ||
if (isEqual((_current4 = current) === null || _current4 === void 0 ? void 0 : _current4.next.value, element)) { | ||
var _current5, _current6; | ||
deletedNode = (_current4 = current) === null || _current4 === void 0 ? void 0 : _current4.next; | ||
current.next = (_current5 = current) === null || _current5 === void 0 ? void 0 : _current5.next.next; | ||
deletedNode = (_current5 = current) === null || _current5 === void 0 ? void 0 : _current5.next; | ||
current.next = (_current6 = current) === null || _current6 === void 0 ? void 0 : _current6.next.next; | ||
} else { | ||
var _current6; | ||
var _current7; | ||
current = (_current6 = current) === null || _current6 === void 0 ? void 0 : _current6.next; | ||
current = (_current7 = current) === null || _current7 === void 0 ? void 0 : _current7.next; | ||
} | ||
@@ -289,10 +288,10 @@ } | ||
while (((_current7 = current) === null || _current7 === void 0 ? void 0 : _current7.next) !== null) { | ||
var _current7, _current8; | ||
while (((_current8 = current) === null || _current8 === void 0 ? void 0 : _current8.next) !== null) { | ||
var _current8, _current9; | ||
if (!((_current8 = current) === null || _current8 === void 0 ? void 0 : _current8.next.next)) { | ||
var _current9; | ||
if (!((_current9 = current) === null || _current9 === void 0 ? void 0 : _current9.next.next)) { | ||
var _current10; | ||
/* istanbul ignore else */ | ||
if ((_current9 = current) === null || _current9 === void 0 ? void 0 : _current9.next) { | ||
if ((_current10 = current) === null || _current10 === void 0 ? void 0 : _current10.next) { | ||
deletedNode = current.next; | ||
@@ -299,0 +298,0 @@ current.next = null; |
{ | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"license": "MIT", | ||
@@ -53,3 +53,4 @@ "main": "dist/index.js", | ||
"stack", | ||
"queue" | ||
"queue", | ||
"hash table" | ||
], | ||
@@ -69,3 +70,5 @@ "module": "dist/rahome.esm.js", | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
"fast-deep-equal": "~3.1.1" | ||
} | ||
} |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
120675
1
20
1478
2
+ Addedfast-deep-equal@~3.1.1
+ Addedfast-deep-equal@3.1.3(transitive)