New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@hallysonh/pageable

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hallysonh/pageable - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

lib/pageable.es5.js

@@ -1,2 +0,2 @@

var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};function __extends(t,e){function r(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Direction,PageableError=function(t){function e(e){var r=t.call(this,e)||this;return r.name="PageableError",r.message=e,r.stack=(new Error).stack,r}return __extends(e,t),e.status=400,e}(Error),NumberFormatError=function(t){function e(e){var r=t.call(this,e)||this;return r.name="NumberFormatError",r.message=e,r.stack=(new Error).stack,r}return __extends(e,t),e.status=400,e}(PageableError),InvalidSortError=function(t){function e(){var e=t.call(this,'Invalid Sort Direction, must be one of "asc" or "desc"')||this;return e.name="InvalidDirectionError",e.stack=(new Error).stack,e}return __extends(e,t),e.status=400,e}(PageableError);!function(t){t.asc="asc",t.desc="desc"}(Direction||(Direction={}));var Order=function(){function t(e,r){void 0===r&&(r=t._DEFAULT_DIRECTION),this.direction=t._DEFAULT_DIRECTION,r.toLowerCase()===Direction.desc&&(this.direction=Direction.desc),this.property=e}return t._DEFAULT_DIRECTION=Direction.asc,t}();function stringToDirection(t){if(!t||""===t.trim())return Order._DEFAULT_DIRECTION;if(t===Direction.asc)return Direction.asc;if(t===Direction.desc)return Direction.desc;throw new InvalidSortError}var Sort=function(){function t(t){this.orders=t}return t.prototype.iterator=function(){var t=this,e={pointer:0,next:function(){var r=t.orders;return e.pointer<r.length?{done:!1,value:t.orders[e.pointer++]}:{done:!0}}};return e},t.prototype.forEach=function(t){this.orders.forEach(function(e){return t(e.property,e.direction)})},t.prototype.toJSON=function(){return this.orders},t}();function parseSort(t){var e;Array.isArray(t)?(e=new Array,t.map(function(t){return t.split(",")}).forEach(function(t){t.forEach(function(t){return e.push(t)})})):e=t.split(",");var r=e.filter(function(t){return t.length>0}).map(function(t){var e=t.split(":").filter(function(t){return t.length>0});return new Order(e[0],stringToDirection(e[1]))});return new Sort(r)}var Pageable=function(){return function(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=20),void 0===r&&(r=!1),this.page=t,this.size=e,this.indexed=r,n&&(this.sort=n instanceof Sort?n:parseSort(n))}}(),Page=function(){return function(t,e){this.numberOfElements=0,this.number=e.page,this.size=e.size,this.sort=e.sort,this.totalElements=t,this.totalPages=Math.max(Math.ceil(t/this.size),1),this.first=0===this.number,this.last=this.number>=this.totalPages-1}}(),ArrayPage=function(t){function e(e,r,n){void 0===e&&(e=[]);var i=t.call(this,r,n)||this;return i.content=e,i.numberOfElements=i.content.length,i}return __extends(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new Pageable(this.number,this.size,!1,this.sort))},e}(Page),IndexedPage=function(t){function e(e,r,n,i){var o=t.call(this,n,i)||this;return o.ids=e,o.index=r,o.numberOfElements=r.values.length,o}return __extends(e,t),e.prototype.map=function(t){var r=new Map;return this.index.forEach(function(e,n){return r.set(n,t(e,n))}),new e(this.ids,r,this.totalElements,new Pageable(this.number,this.size,!0,this.sort))},e}(Page),IndexablePage=function(t){function e(e,r,n){void 0===e&&(e=[]);var i=t.call(this,r,n)||this;return i.indexed=!1,i.content=e,i.indexed=!!n.indexed,i.numberOfElements=i.content.length,i}return __extends(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new Pageable(this.number,this.size,this.indexed,this.sort))},e.prototype.toJSON=function(){if(this.indexed){var t=this.content.map(function(t){return t.id}),e=new Map;return this.content.map(function(t){return e.set(t.id,t)}),new IndexedPage(t,e,this.totalElements,new Pageable(this.number,this.size,this.indexed,this.sort))}return new ArrayPage(this.content,this.totalElements,new Pageable(this.number,this.size,this.indexed,this.sort))},e}(Page);export{PageableError,NumberFormatError,InvalidSortError,Direction,Order,Sort,Pageable,Page,ArrayPage,IndexedPage,IndexablePage};
var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};function __extends(t,e){function r(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Direction,PageableError=function(t){function e(e){var r=t.call(this,e)||this;return r.name="PageableError",r.message=e,r.stack=(new Error).stack,r}return __extends(e,t),e.status=400,e}(Error),NumberFormatError=function(t){function e(e){var r=t.call(this,e)||this;return r.name="NumberFormatError",r.message=e,r.stack=(new Error).stack,r}return __extends(e,t),e.status=400,e}(PageableError),InvalidSortError=function(t){function e(){var e=t.call(this,'Invalid Sort Direction, must be one of "asc" or "desc"')||this;return e.name="InvalidDirectionError",e.stack=(new Error).stack,e}return __extends(e,t),e.status=400,e}(PageableError);!function(t){t.asc="asc",t.desc="desc"}(Direction||(Direction={}));var Order=function(){function t(e,r){void 0===r&&(r=t._DEFAULT_DIRECTION),this.direction=t._DEFAULT_DIRECTION,r.toLowerCase()===Direction.desc&&(this.direction=Direction.desc),this.property=e}return t._DEFAULT_DIRECTION=Direction.asc,t}();function stringToDirection(t){if(!t||""===t.trim())return Order._DEFAULT_DIRECTION;if(t===Direction.asc)return Direction.asc;if(t===Direction.desc)return Direction.desc;throw new InvalidSortError}var Sort=function(){function t(t){this.orders=t}return t.prototype.iterator=function(){var t=this,e={pointer:0,next:function(){var r=t.orders;return e.pointer<r.length?{done:!1,value:t.orders[e.pointer++]}:{done:!0}}};return e},t.prototype.forEach=function(t){this.orders.forEach(function(e){return t(e.property,e.direction)})},t.prototype.toJSON=function(){return this.orders},t}();function parseSort(t){var e;Array.isArray(t)?(e=new Array,console.log(),t.map(function(t){return t.split(":")}).forEach(function(t){e.push(t)})):e=t.split(";").map(function(t){return t.split(":")});var r=e.filter(function(t){return t.length>0}).filter(function(t){return t.length>0&&t[0].length>0}).map(function(t){return new Order(t[0],stringToDirection(t[1]))});return new Sort(r)}var Pageable=function(){return function(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=20),void 0===r&&(r=!1),this.page=t,this.size=e,this.indexed=r,n&&(this.sort=n instanceof Sort?n:parseSort(n))}}(),Page=function(){return function(t,e){this.numberOfElements=0,this.number=e.page,this.size=e.size,this.sort=e.sort,this.totalElements=t,this.totalPages=Math.max(Math.ceil(t/this.size),1),this.first=0===this.number,this.last=this.number>=this.totalPages-1}}(),ArrayPage=function(t){function e(e,r,n){void 0===e&&(e=[]);var i=t.call(this,r,n)||this;return i.content=e,i.numberOfElements=i.content.length,i}return __extends(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new Pageable(this.number,this.size,!1,this.sort))},e}(Page),IndexedPage=function(t){function e(e,r,n,i){var o=t.call(this,n,i)||this;return o.ids=e,o.index=r,o.numberOfElements=r.values.length,o}return __extends(e,t),e.prototype.map=function(t){var r=new Map;return this.index.forEach(function(e,n){return r.set(n,t(e,n))}),new e(this.ids,r,this.totalElements,new Pageable(this.number,this.size,!0,this.sort))},e}(Page),IndexablePage=function(t){function e(e,r,n){void 0===e&&(e=[]);var i=t.call(this,r,n)||this;return i.indexed=!1,i.content=e,i.indexed=!!n.indexed,i.numberOfElements=i.content.length,i}return __extends(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new Pageable(this.number,this.size,this.indexed,this.sort))},e.prototype.toJSON=function(){if(this.indexed){var t=this.content.map(function(t){return t.id}),e=new Map;return this.content.map(function(t){return e.set(t.id,t)}),new IndexedPage(t,e,this.totalElements,new Pageable(this.number,this.size,this.indexed,this.sort))}return new ArrayPage(this.content,this.totalElements,new Pageable(this.number,this.size,this.indexed,this.sort))},e}(Page);export{PageableError,NumberFormatError,InvalidSortError,Direction,Order,Sort,Pageable,Page,ArrayPage,IndexedPage,IndexablePage};
//# sourceMappingURL=pageable.es5.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.pageable={})}(this,function(t){"use strict";var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i=function(t){function e(e){var n=t.call(this,e)||this;return n.name="PageableError",n.message=e,n.stack=(new Error).stack,n}return n(e,t),e.status=400,e}(Error),o=function(t){function e(e){var n=t.call(this,e)||this;return n.name="NumberFormatError",n.message=e,n.stack=(new Error).stack,n}return n(e,t),e.status=400,e}(i),s=function(t){function e(){var e=t.call(this,'Invalid Sort Direction, must be one of "asc" or "desc"')||this;return e.name="InvalidDirectionError",e.stack=(new Error).stack,e}return n(e,t),e.status=400,e}(i);(r=t.Direction||(t.Direction={})).asc="asc",r.desc="desc";var u=function(){function e(n,r){void 0===r&&(r=e._DEFAULT_DIRECTION),this.direction=e._DEFAULT_DIRECTION,r.toLowerCase()===t.Direction.desc&&(this.direction=t.Direction.desc),this.property=n}return e._DEFAULT_DIRECTION=t.Direction.asc,e}();var c=function(){function t(t){this.orders=t}return t.prototype.iterator=function(){var t=this,e={pointer:0,next:function(){var n=t.orders;return e.pointer<n.length?{done:!1,value:t.orders[e.pointer++]}:{done:!0}}};return e},t.prototype.forEach=function(t){this.orders.forEach(function(e){return t(e.property,e.direction)})},t.prototype.toJSON=function(){return this.orders},t}();function a(e){var n;Array.isArray(e)?(n=new Array,e.map(function(t){return t.split(",")}).forEach(function(t){t.forEach(function(t){return n.push(t)})})):n=e.split(",");var r=n.filter(function(t){return t.length>0}).map(function(e){var n=e.split(":").filter(function(t){return t.length>0});return new u(n[0],function(e){if(!e||""===e.trim())return u._DEFAULT_DIRECTION;if(e===t.Direction.asc)return t.Direction.asc;if(e===t.Direction.desc)return t.Direction.desc;throw new s}(n[1]))});return new c(r)}var h=function(){return function(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=20),void 0===n&&(n=!1),this.page=t,this.size=e,this.indexed=n,r&&(this.sort=r instanceof c?r:a(r))}}(),f=function(){return function(t,e){this.numberOfElements=0,this.number=e.page,this.size=e.size,this.sort=e.sort,this.totalElements=t,this.totalPages=Math.max(Math.ceil(t/this.size),1),this.first=0===this.number,this.last=this.number>=this.totalPages-1}}(),d=function(t){function e(e,n,r){void 0===e&&(e=[]);var i=t.call(this,n,r)||this;return i.content=e,i.numberOfElements=i.content.length,i}return n(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new h(this.number,this.size,!1,this.sort))},e}(f),l=function(t){function e(e,n,r,i){var o=t.call(this,r,i)||this;return o.ids=e,o.index=n,o.numberOfElements=n.values.length,o}return n(e,t),e.prototype.map=function(t){var n=new Map;return this.index.forEach(function(e,r){return n.set(r,t(e,r))}),new e(this.ids,n,this.totalElements,new h(this.number,this.size,!0,this.sort))},e}(f),p=function(t){function e(e,n,r){void 0===e&&(e=[]);var i=t.call(this,n,r)||this;return i.indexed=!1,i.content=e,i.indexed=!!r.indexed,i.numberOfElements=i.content.length,i}return n(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new h(this.number,this.size,this.indexed,this.sort))},e.prototype.toJSON=function(){if(this.indexed){var t=this.content.map(function(t){return t.id}),e=new Map;return this.content.map(function(t){return e.set(t.id,t)}),new l(t,e,this.totalElements,new h(this.number,this.size,this.indexed,this.sort))}return new d(this.content,this.totalElements,new h(this.number,this.size,this.indexed,this.sort))},e}(f);t.PageableError=i,t.NumberFormatError=o,t.InvalidSortError=s,t.Order=u,t.Sort=c,t.Pageable=h,t.Page=f,t.ArrayPage=d,t.IndexedPage=l,t.IndexablePage=p,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.pageable={})}(this,function(t){"use strict";var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i=function(t){function e(e){var n=t.call(this,e)||this;return n.name="PageableError",n.message=e,n.stack=(new Error).stack,n}return n(e,t),e.status=400,e}(Error),o=function(t){function e(e){var n=t.call(this,e)||this;return n.name="NumberFormatError",n.message=e,n.stack=(new Error).stack,n}return n(e,t),e.status=400,e}(i),s=function(t){function e(){var e=t.call(this,'Invalid Sort Direction, must be one of "asc" or "desc"')||this;return e.name="InvalidDirectionError",e.stack=(new Error).stack,e}return n(e,t),e.status=400,e}(i);(r=t.Direction||(t.Direction={})).asc="asc",r.desc="desc";var u=function(){function e(n,r){void 0===r&&(r=e._DEFAULT_DIRECTION),this.direction=e._DEFAULT_DIRECTION,r.toLowerCase()===t.Direction.desc&&(this.direction=t.Direction.desc),this.property=n}return e._DEFAULT_DIRECTION=t.Direction.asc,e}();var c=function(){function t(t){this.orders=t}return t.prototype.iterator=function(){var t=this,e={pointer:0,next:function(){var n=t.orders;return e.pointer<n.length?{done:!1,value:t.orders[e.pointer++]}:{done:!0}}};return e},t.prototype.forEach=function(t){this.orders.forEach(function(e){return t(e.property,e.direction)})},t.prototype.toJSON=function(){return this.orders},t}();function a(e){var n;Array.isArray(e)?(n=new Array,console.log(),e.map(function(t){return t.split(":")}).forEach(function(t){n.push(t)})):n=e.split(";").map(function(t){return t.split(":")});var r=n.filter(function(t){return t.length>0}).filter(function(t){return t.length>0&&t[0].length>0}).map(function(e){return new u(e[0],function(e){if(!e||""===e.trim())return u._DEFAULT_DIRECTION;if(e===t.Direction.asc)return t.Direction.asc;if(e===t.Direction.desc)return t.Direction.desc;throw new s}(e[1]))});return new c(r)}var h=function(){return function(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=20),void 0===n&&(n=!1),this.page=t,this.size=e,this.indexed=n,r&&(this.sort=r instanceof c?r:a(r))}}(),f=function(){return function(t,e){this.numberOfElements=0,this.number=e.page,this.size=e.size,this.sort=e.sort,this.totalElements=t,this.totalPages=Math.max(Math.ceil(t/this.size),1),this.first=0===this.number,this.last=this.number>=this.totalPages-1}}(),d=function(t){function e(e,n,r){void 0===e&&(e=[]);var i=t.call(this,n,r)||this;return i.content=e,i.numberOfElements=i.content.length,i}return n(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new h(this.number,this.size,!1,this.sort))},e}(f),l=function(t){function e(e,n,r,i){var o=t.call(this,r,i)||this;return o.ids=e,o.index=n,o.numberOfElements=n.values.length,o}return n(e,t),e.prototype.map=function(t){var n=new Map;return this.index.forEach(function(e,r){return n.set(r,t(e,r))}),new e(this.ids,n,this.totalElements,new h(this.number,this.size,!0,this.sort))},e}(f),p=function(t){function e(e,n,r){void 0===e&&(e=[]);var i=t.call(this,n,r)||this;return i.indexed=!1,i.content=e,i.indexed=!!r.indexed,i.numberOfElements=i.content.length,i}return n(e,t),e.prototype.map=function(t){return new e(this.content.map(t),this.totalElements,new h(this.number,this.size,this.indexed,this.sort))},e.prototype.toJSON=function(){if(this.indexed){var t=this.content.map(function(t){return t.id}),e=new Map;return this.content.map(function(t){return e.set(t.id,t)}),new l(t,e,this.totalElements,new h(this.number,this.size,this.indexed,this.sort))}return new d(this.content,this.totalElements,new h(this.number,this.size,this.indexed,this.sort))},e}(f);t.PageableError=i,t.NumberFormatError=o,t.InvalidSortError=s,t.Order=u,t.Sort=c,t.Pageable=h,t.Page=f,t.ArrayPage=d,t.IndexedPage=l,t.IndexablePage=p,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=pageable.umd.js.map
{
"name": "@hallysonh/pageable",
"version": "1.0.2",
"version": "1.0.3",
"description": "Pagination inspired by Spring Data's Pagination approach.",

@@ -36,2 +36,8 @@ "keywords": [

},
"contributors": [
{
"name": "Pandera Labs",
"url": "https://www.panderalabs.com"
}
],
"license": "ISC",

@@ -53,3 +59,3 @@ "homepage": "https://github.com/hallysonh/pageable#readme",

"@types/jest": "^22.1.2",
"@types/node": "^9.4.6",
"@types/node": "^10.0.9",
"commitizen": "^2.9.6",

@@ -59,21 +65,21 @@ "cz-conventional-changelog": "^2.1.0",

"jest": "^22.4.0",
"lint-staged": "^6.0.0",
"lint-staged": "^7.0.0",
"prettier": "^1.4.4",
"prompt": "^1.0.0",
"rimraf": "^2.6.1",
"rollup": "^0.55.5",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-json": "^2.3.0",
"rollup": "^0.58.2",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-json": "^3.0.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-typescript2": "^0.11.1",
"rollup-plugin-typescript2": "^0.14.0",
"rollup-plugin-uglify": "^3.0.0",
"semantic-release": "^15.0.2",
"travis-deploy-once": "^4.4.0",
"travis-deploy-once": "^5.0.0",
"ts-jest": "^22.0.4",
"ts-node": "^4.1.0",
"ts-node": "^6.0.3",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.1.0",
"tslint-config-standard": "^7.0.0",
"typedoc": "^0.10.0",
"typedoc": "^0.11.1",
"typescript": "^2.6.2",

@@ -80,0 +86,0 @@ "validate-commit-msg": "^2.12.2"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc