Skip to content

Commit

Permalink
Don't be so strict about falsiness comparison
Browse files Browse the repository at this point in the history
(match this with the rest of the code)
  • Loading branch information
mdziekon committed Oct 7, 2015
1 parent 1e768f2 commit b67bb44
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,39 @@ const Pagination = React.createClass({
maxButtons: React.PropTypes.number,
/**
* When `true`, will display the default node value ('...').
* When exactly `false`, will not display the element at all.
* Every other value (`truthy` or `null`) will be passed "as is".
* Otherwise, will display provided node (when specified).
*/
ellipsis: React.PropTypes.oneOfType([
React.PropTypes.bool,
React.PropTypes.node
]),
/**
* When `true`, will display the default node value ('«').
* When exactly `false`, will not display the element at all.
* Every other value (`truthy` or `null`) will be passed "as is".
* Otherwise, will display provided node (when specified).
*/
first: React.PropTypes.oneOfType([
React.PropTypes.bool,
React.PropTypes.node
]),
/**
* When `true`, will display the default node value ('»').
* When exactly `false`, will not display the element at all.
* Every other value (`truthy` or `null`) will be passed "as is".
* Otherwise, will display provided node (when specified).
*/
last: React.PropTypes.oneOfType([
React.PropTypes.bool,
React.PropTypes.node
]),
/**
* When `true`, will display the default node value ('‹').
* When exactly `false`, will not display the element at all.
* Every other value (`truthy` or `null`) will be passed "as is".
* Otherwise, will display provided node (when specified).
*/
prev: React.PropTypes.oneOfType([
React.PropTypes.bool,
React.PropTypes.node
]),
/**
* When `true`, will display the default node value ('›').
* When exactly `false`, will not display the element at all.
* Every other value (`truthy` or `null`) will be passed "as is".
* Otherwise, will display provided node (when specified).
*/
next: React.PropTypes.oneOfType([
React.PropTypes.bool,
Expand Down Expand Up @@ -123,7 +118,7 @@ const Pagination = React.createClass({
);
}

if (maxButtons && hasHiddenPagesAfter && ellipsis !== false) {
if (maxButtons && hasHiddenPagesAfter && ellipsis) {
pageButtons.push(
<PaginationButton
key="ellipsis"
Expand All @@ -140,7 +135,7 @@ const Pagination = React.createClass({
},

renderPrev() {
if (this.props.prev === false) {
if (!this.props.prev) {
return null;
}

Expand All @@ -159,7 +154,7 @@ const Pagination = React.createClass({
},

renderNext() {
if (this.props.next === false) {
if (!this.props.next) {
return null;
}

Expand All @@ -178,7 +173,7 @@ const Pagination = React.createClass({
},

renderFirst() {
if (this.props.first === false) {
if (!this.props.first) {
return null;
}

Expand All @@ -197,7 +192,7 @@ const Pagination = React.createClass({
},

renderLast() {
if (this.props.last === false) {
if (!this.props.last) {
return null;
}

Expand Down

0 comments on commit b67bb44

Please sign in to comment.