Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Type safety for total- and visiblePages options (issue#17)
  • Loading branch information
Eugene Simakin committed Sep 9, 2014
1 parent d4225c3 commit da723fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
14 changes: 10 additions & 4 deletions jquery.twbsPagination.js
@@ -1,5 +1,5 @@
/**
* jQuery pagination plugin v1.2.0
/*!
* jQuery pagination plugin v1.2.1
* http://esimakin.github.io/twbs-pagination/
*
* Copyright 2014, Eugene Simakin
Expand All @@ -23,8 +23,14 @@
throw new Error('Start page option is incorrect');
}

if (this.options.totalPages <= 0) {
throw new Error('Total pages option cannot be less 1 (one)!');
this.options.totalPages = parseInt(this.options.totalPages);
if (isNaN(this.options.totalPages)) {
throw new Error('Total pages option is not correct!');
}

this.options.visiblePages = parseInt(this.options.visiblePages);
if (isNaN(this.options.visiblePages)) {
throw new Error('Visible pages option is not correct!');
}

if (this.options.totalPages < this.options.visiblePages) {
Expand Down
10 changes: 9 additions & 1 deletion jquery.twbsPagination.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da723fd

Please sign in to comment.