mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 11:03:57 +03:00
counting entries of iterable structure
This commit is contained in:
parent
04f15f6d4d
commit
11af53ccfb
|
@ -87,10 +87,12 @@ export default class JSONIterableNode extends React.Component {
|
||||||
if (!this.itemString) {
|
if (!this.itemString) {
|
||||||
const { data } = this.props;
|
const { data } = this.props;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if (typeof data.count === 'function') {
|
if (typeof data.size !== 'undefined') {
|
||||||
count = data.count();
|
count = data.size;
|
||||||
} else {
|
} else {
|
||||||
count = data.length;
|
for (const entry of data) { // eslint-disable-line no-unused-vars
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.itemString = count + ' entr' + (count !== 1 ? 'ies' : 'y');
|
this.itemString = count + ' entr' + (count !== 1 ? 'ies' : 'y');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user