@js-sdsl/vector
Advanced tools
Comparing version 4.4.0 to 4.4.2
@@ -7,2 +7,18 @@ # Change Log | ||
## [4.4.2] - 2023.07.21 | ||
### Fixed | ||
- The pointer of Adapter container's iterator cannot as array to be deconstructed. | ||
### Added | ||
- Add `isAccessible` function to iterators for iterable containers. | ||
## [4.4.1] - 2023.06.05 | ||
### Fixed | ||
- Tree container with less than 3 items reverse iteration infinite loop | ||
## [4.4.0] - 2023.03.17 | ||
@@ -9,0 +25,0 @@ |
@@ -73,2 +73,3 @@ /** | ||
abstract copy(): ContainerIterator<T>; | ||
abstract isAccessible(): boolean; | ||
} | ||
@@ -279,2 +280,3 @@ declare abstract class Base { | ||
set pointer(newValue: T); | ||
isAccessible(): boolean; | ||
// @ts-ignore | ||
@@ -281,0 +283,0 @@ pre(): this; |
@@ -81,2 +81,5 @@ "use strict"; | ||
} | ||
isAccessible() { | ||
return this.i !== this.container.size(); | ||
} | ||
} | ||
@@ -83,0 +86,0 @@ |
@@ -73,2 +73,3 @@ /** | ||
abstract copy(): ContainerIterator<T>; | ||
abstract isAccessible(): boolean; | ||
} | ||
@@ -279,2 +280,3 @@ declare abstract class Base { | ||
set pointer(newValue: T); | ||
isAccessible(): boolean; | ||
// @ts-ignore | ||
@@ -281,0 +283,0 @@ pre(): this; |
@@ -156,2 +156,7 @@ var extendStatics = function(t, r) { | ||
typeof SuppressedError === "function" ? SuppressedError : function(t, r, n) { | ||
var e = new Error(n); | ||
return e.name = "SuppressedError", e.error = t, e.suppressed = r, e; | ||
}; | ||
var ContainerIterator = function() { | ||
@@ -258,2 +263,5 @@ function ContainerIterator(t) { | ||
}); | ||
RandomIterator.prototype.isAccessible = function() { | ||
return this.t !== this.container.size(); | ||
}; | ||
return RandomIterator; | ||
@@ -260,0 +268,0 @@ }(ContainerIterator); |
/*! | ||
* @js-sdsl/vector v4.4.0 | ||
* @js-sdsl/vector v4.4.2 | ||
* https://github.com/js-sdsl/js-sdsl | ||
@@ -28,3 +28,3 @@ * (c) 2021-present ZLY201 <zilongyao1366@gmail.com> | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
/* global Reflect, Promise, SuppressedError, Symbol */ | ||
@@ -184,2 +184,6 @@ var extendStatics = function (d, b) { | ||
} | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
@@ -323,2 +327,5 @@ var ContainerIterator = /** @class */function () { | ||
}); | ||
RandomIterator.prototype.isAccessible = function () { | ||
return this._node !== this.container.size(); | ||
}; | ||
return RandomIterator; | ||
@@ -325,0 +332,0 @@ }(ContainerIterator); |
/*! | ||
* @js-sdsl/vector v4.4.0 | ||
* @js-sdsl/vector v4.4.2 | ||
* https://github.com/js-sdsl/js-sdsl | ||
@@ -7,3 +7,3 @@ * (c) 2021-present ZLY201 <zilongyao1366@gmail.com> | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}))(t,e)};function e(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(n,o){var i,s,u,h={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},c={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function t(r){return function(t){var e=[r,t];if(i)throw new TypeError("Generator is already executing.");for(;h=c&&e[c=0]?0:h;)try{if(i=1,s&&(u=2&e[0]?s.return:e[0]?s.throw||((u=s.return)&&u.call(s),0):s.next)&&!(u=u.call(s,e[1])).done)return u;switch(s=0,(e=u?[2&e[0],u.value]:e)[0]){case 0:case 1:u=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,s=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(u=0<(u=h.trys).length&&u[u.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!u||e[1]>u[0]&&e[1]<u[3]))h.label=e[1];else if(6===e[0]&&h.label<u[1])h.label=u[1],u=e;else{if(!(u&&h.label<u[2])){u[2]&&h.ops.pop(),h.trys.pop();continue}h.label=u[2],h.ops.push(e)}}e=o.call(n,h)}catch(t){e=[6,t],s=0}finally{i=u=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}}function o(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function i(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}u.prototype.equals=function(t){return this.t===t.t};var s=u;function u(t){this.iteratorType=t=void 0===t?0:t}function h(){this.i=0}Object.defineProperty(h.prototype,"length",{get:function(){return this.i},enumerable:!1,configurable:!0}),h.prototype.size=function(){return this.i},h.prototype.empty=function(){return 0===this.i};e(a,c=h);var c,p=a;function a(){return null!==c&&c.apply(this,arguments)||this}e(l,f=p);var f,p=l;function l(){return null!==f&&f.apply(this,arguments)||this}function y(){throw new RangeError("Iterator access denied!")}e(v,d=s),Object.defineProperty(v.prototype,"pointer",{get:function(){return this.container.getElementByPos(this.t)},set:function(t){this.container.setElementByPos(this.t,t)},enumerable:!1,configurable:!0});var d,s=v;function v(t,e){e=d.call(this,e)||this;return e.t=t,0===e.iteratorType?(e.pre=function(){return 0===this.t&&y(),--this.t,this},e.next=function(){return this.t===this.container.size()&&y(),this.t+=1,this}):(e.pre=function(){return this.t===this.container.size()-1&&y(),this.t+=1,this},e.next=function(){return-1===this.t&&y(),--this.t,this}),e}e(g,b=s),g.prototype.copy=function(){return new g(this.t,this.container,this.iteratorType)};var b,w=g;function g(t,e,r){t=b.call(this,t,r)||this;return t.container=e,t}e(E,m=p),E.prototype.clear=function(){this.i=0,this.o.length=0},E.prototype.begin=function(){return new w(0,this)},E.prototype.end=function(){return new w(this.i,this)},E.prototype.rBegin=function(){return new w(this.i-1,this,1)},E.prototype.rEnd=function(){return new w(-1,this,1)},E.prototype.front=function(){return this.o[0]},E.prototype.back=function(){return this.o[this.i-1]},E.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.o[t]},E.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.o.splice(t,1),--this.i,this.i},E.prototype.eraseElementByValue=function(t){for(var e=0,r=0;r<this.i;++r)this.o[r]!==t&&(this.o[e++]=this.o[r]);return this.i=this.o.length=e,this.i},E.prototype.eraseElementByIterator=function(t){var e=t.t;return t=t.next(),this.eraseElementByPos(e),t},E.prototype.pushBack=function(t){return this.o.push(t),this.i+=1,this.i},E.prototype.popBack=function(){if(0!==this.i)return--this.i,this.o.pop()},E.prototype.setElementByPos=function(t,e){if(t<0||t>this.i-1)throw new RangeError;this.o[t]=e},E.prototype.insert=function(t,e,r){var n;if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;return(n=this.o).splice.apply(n,i([t,0],o(new Array(r).fill(e)),!1)),this.i+=r,this.i},E.prototype.find=function(t){for(var e=0;e<this.i;++e)if(this.o[e]===t)return new w(e,this);return this.end()},E.prototype.reverse=function(){return this.o.reverse(),this},E.prototype.unique=function(){for(var t=1,e=1;e<this.i;++e)this.o[e]!==this.o[e-1]&&(this.o[t++]=this.o[e]);return this.i=this.o.length=t,this.i},E.prototype.sort=function(t){return this.o.sort(t),this},E.prototype.forEach=function(t){for(var e=0;e<this.i;++e)t(this.o[e],e,this)},E.prototype[Symbol.iterator]=function(){return r(this,function(t){switch(t.label){case 0:return[5,function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.o)];case 1:return t.sent(),[2]}})};var m,s=E;function E(t,e){void 0===t&&(t=[]),void 0===e&&(e=!0);var r,n=m.call(this)||this;return Array.isArray(t)?(n.o=e?i([],o(t),!1):t,n.i=t.length):(n.o=[],r=n,t.forEach(function(t){r.pushBack(t)})),n}t.Vector=s,Object.defineProperty(t,"u",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}))(t,e)};function e(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function r(n,o){var i,s,u,h={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]},c={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function t(r){return function(t){var e=[r,t];if(i)throw new TypeError("Generator is already executing.");for(;h=c&&e[c=0]?0:h;)try{if(i=1,s&&(u=2&e[0]?s.return:e[0]?s.throw||((u=s.return)&&u.call(s),0):s.next)&&!(u=u.call(s,e[1])).done)return u;switch(s=0,(e=u?[2&e[0],u.value]:e)[0]){case 0:case 1:u=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,s=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(u=0<(u=h.trys).length&&u[u.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!u||e[1]>u[0]&&e[1]<u[3]))h.label=e[1];else if(6===e[0]&&h.label<u[1])h.label=u[1],u=e;else{if(!(u&&h.label<u[2])){u[2]&&h.ops.pop(),h.trys.pop();continue}h.label=u[2],h.ops.push(e)}}e=o.call(n,h)}catch(t){e=[6,t],s=0}finally{i=u=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}}}function o(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function i(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||((n=n||Array.prototype.slice.call(e,0,o))[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}u.prototype.equals=function(t){return this.t===t.t};var s=u;function u(t){this.iteratorType=t=void 0===t?0:t}function h(){this.i=0}Object.defineProperty(h.prototype,"length",{get:function(){return this.i},enumerable:!1,configurable:!0}),h.prototype.size=function(){return this.i},h.prototype.empty=function(){return 0===this.i};e(a,c=h);var c,p=a;function a(){return null!==c&&c.apply(this,arguments)||this}e(l,f=p);var f,p=l;function l(){return null!==f&&f.apply(this,arguments)||this}function y(){throw new RangeError("Iterator access denied!")}e(d,b=s),Object.defineProperty(d.prototype,"pointer",{get:function(){return this.container.getElementByPos(this.t)},set:function(t){this.container.setElementByPos(this.t,t)},enumerable:!1,configurable:!0}),d.prototype.isAccessible=function(){return this.t!==this.container.size()};var b,s=d;function d(t,e){e=b.call(this,e)||this;return e.t=t,0===e.iteratorType?(e.pre=function(){return 0===this.t&&y(),--this.t,this},e.next=function(){return this.t===this.container.size()&&y(),this.t+=1,this}):(e.pre=function(){return this.t===this.container.size()-1&&y(),this.t+=1,this},e.next=function(){return-1===this.t&&y(),--this.t,this}),e}e(g,v=s),g.prototype.copy=function(){return new g(this.t,this.container,this.iteratorType)};var v,w=g;function g(t,e,r){t=v.call(this,t,r)||this;return t.container=e,t}e(E,m=p),E.prototype.clear=function(){this.i=0,this.o.length=0},E.prototype.begin=function(){return new w(0,this)},E.prototype.end=function(){return new w(this.i,this)},E.prototype.rBegin=function(){return new w(this.i-1,this,1)},E.prototype.rEnd=function(){return new w(-1,this,1)},E.prototype.front=function(){return this.o[0]},E.prototype.back=function(){return this.o[this.i-1]},E.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.o[t]},E.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.o.splice(t,1),--this.i,this.i},E.prototype.eraseElementByValue=function(t){for(var e=0,r=0;r<this.i;++r)this.o[r]!==t&&(this.o[e++]=this.o[r]);return this.i=this.o.length=e,this.i},E.prototype.eraseElementByIterator=function(t){var e=t.t;return t=t.next(),this.eraseElementByPos(e),t},E.prototype.pushBack=function(t){return this.o.push(t),this.i+=1,this.i},E.prototype.popBack=function(){if(0!==this.i)return--this.i,this.o.pop()},E.prototype.setElementByPos=function(t,e){if(t<0||t>this.i-1)throw new RangeError;this.o[t]=e},E.prototype.insert=function(t,e,r){var n;if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;return(n=this.o).splice.apply(n,i([t,0],o(new Array(r).fill(e)),!1)),this.i+=r,this.i},E.prototype.find=function(t){for(var e=0;e<this.i;++e)if(this.o[e]===t)return new w(e,this);return this.end()},E.prototype.reverse=function(){return this.o.reverse(),this},E.prototype.unique=function(){for(var t=1,e=1;e<this.i;++e)this.o[e]!==this.o[e-1]&&(this.o[t++]=this.o[e]);return this.i=this.o.length=t,this.i},E.prototype.sort=function(t){return this.o.sort(t),this},E.prototype.forEach=function(t){for(var e=0;e<this.i;++e)t(this.o[e],e,this)},E.prototype[Symbol.iterator]=function(){return r(this,function(t){switch(t.label){case 0:return[5,function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&n>=t.length?void 0:t)&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.o)];case 1:return t.sent(),[2]}})};var m,s=E;function E(t,e){void 0===t&&(t=[]),void 0===e&&(e=!0);var r,n=m.call(this)||this;return Array.isArray(t)?(n.o=e?i([],o(t),!1):t,n.i=t.length):(n.o=[],r=n,t.forEach(function(t){r.pushBack(t)})),n}t.Vector=s,Object.defineProperty(t,"u",{value:!0})}); | ||
//# sourceMappingURL=vector.min.js.map |
{ | ||
"name": "@js-sdsl/vector", | ||
"version": "4.4.0", | ||
"version": "4.4.2", | ||
"description": "javascript standard data structure library which benchmark against C++ STL", | ||
@@ -32,2 +32,3 @@ "main": "./dist/cjs/index.js", | ||
"@types/delete-empty": "^3.0.2", | ||
"@types/glob": "^8.1.0", | ||
"@types/gulp": "^4.0.9", | ||
@@ -34,0 +35,0 @@ "@types/gulp-babel": "^6.1.30", |
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
202074
1783
74