array-limits
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var extendStatics=function(t,r){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])})(t,r)};function __extends(t,r){function i(){this.constructor=t}extendStatics(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var ArrayLimitException=function(e){function n(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=e.apply(this,t)||this;return i.name="ArrayLimitException",i.message="Array is set to have "+t[0]+" elements only. Array is now full.",Error.captureStackTrace(i,n),i}return __extends(n,e),n}(RangeError),InvalidLimitValueException=function(e){function n(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=e.apply(this,t)||this;return i.name="InvalidLimitValueException",i.message="Minimum array limit should be 1",Error.captureStackTrace(i,n),i}return __extends(n,e),n}(RangeError);Array.prototype.isFull=function(){return this.length>=this.limit},Array.prototype.availableSpace=function(){return this.limit-this.length},Array.prototype.full=function(){if(this.limit||(this.limit=1e6),this.isFull())throw new ArrayLimitException(this.limit);return this},Array.prototype.limit=function(t){if(t<1)throw new InvalidLimitValueException;return this.limit=t,this},Array.prototype.push=function(){var t=Array.prototype.push;return function(){return this.full(),t.apply(this,arguments)}}(),exports.ArrayLimitException=ArrayLimitException,exports.InvalidLimitValueException=InvalidLimitValueException; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var extendStatics=function(t,r){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)r.hasOwnProperty(i)&&(t[i]=r[i])})(t,r)};function __extends(t,r){function i(){this.constructor=t}extendStatics(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var ArrayLimitException=function(e){function n(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=e.apply(this,t)||this;return i.name="ArrayLimitException",i.message="It's your fault!",Error.captureStackTrace(i,n),i}return __extends(n,e),n}(RangeError),InvalidLimitValueException=function(e){function n(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=e.apply(this,t)||this;return i.name="InvalidLimitValueException",i.message="It's your fault!",Error.captureStackTrace(i,n),i}return __extends(n,e),n}(RangeError);Array.prototype.isFull=function(){return this.length>=this.limit},Array.prototype.availableSpace=function(){return this.limit-this.length},Array.prototype.full=function(){if(this.limit||(this.limit=1e6),this.isFull())throw new ArrayLimitException(this.limit);return this},Array.prototype.limit=function(t){if(t<1)throw new InvalidLimitValueException;return this.limit=t,this},Array.prototype.push=function(){var t=Array.prototype.push;return function(){return this.full(),t.apply(this,arguments)}}(),exports.ArrayLimitException=ArrayLimitException,exports.InvalidLimitValueException=InvalidLimitValueException; |
{ | ||
"name": "array-limits", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "A way of telling that everything is possible", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
7084