section-iterator
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -11,3 +11,3 @@ "use strict"; | ||
var data = _ref.data; | ||
var isMultiSection = _ref.isMultiSection; | ||
var multiSection = _ref.multiSection; | ||
@@ -48,3 +48,3 @@ function nextNonEmptySectionIndex(sectionIndex) { | ||
if (isMultiSection) { | ||
if (multiSection) { | ||
if (itemIndex === null || itemIndex === data[sectionIndex] - 1) { | ||
@@ -80,3 +80,3 @@ sectionIndex = nextNonEmptySectionIndex(sectionIndex); | ||
if (isMultiSection) { | ||
if (multiSection) { | ||
if (itemIndex === null || itemIndex === 0) { | ||
@@ -83,0 +83,0 @@ sectionIndex = prevNonEmptySectionIndex(sectionIndex); |
{ | ||
"name": "section-iterator", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Simple iterator for flat and multi section lists", | ||
@@ -5,0 +5,0 @@ "main": "dist/sectionIterator.js", |
@@ -1,2 +0,2 @@ | ||
export default function({ data, isMultiSection }) { | ||
export default function({ data, multiSection }) { | ||
function nextNonEmptySectionIndex(sectionIndex) { | ||
@@ -33,3 +33,3 @@ if (sectionIndex === null) { | ||
if (isMultiSection) { | ||
if (multiSection) { | ||
if (itemIndex === null || itemIndex === data[sectionIndex] - 1) { | ||
@@ -62,3 +62,3 @@ sectionIndex = nextNonEmptySectionIndex(sectionIndex); | ||
if (isMultiSection) { | ||
if (multiSection) { | ||
if (itemIndex === null || itemIndex === 0) { | ||
@@ -65,0 +65,0 @@ sectionIndex = prevNonEmptySectionIndex(sectionIndex); |
import { expect } from 'chai'; | ||
import createSectionIterator from './sectionIterator'; | ||
let sectionIterator, isMultiSection; | ||
let sectionIterator, multiSection; | ||
@@ -9,3 +9,3 @@ describe('sectionIterator', () => { | ||
before(() => { | ||
isMultiSection = false; | ||
multiSection = false; | ||
}); | ||
@@ -15,3 +15,3 @@ | ||
before(() => { | ||
sectionIterator = createSectionIterator({ data: 0, isMultiSection }); | ||
sectionIterator = createSectionIterator({ data: 0, multiSection }); | ||
}); | ||
@@ -34,3 +34,3 @@ | ||
before(() => { | ||
sectionIterator = createSectionIterator({ data: 1, isMultiSection }); | ||
sectionIterator = createSectionIterator({ data: 1, multiSection }); | ||
}); | ||
@@ -56,3 +56,3 @@ | ||
before(() => { | ||
sectionIterator = createSectionIterator({ data: 4, isMultiSection }); | ||
sectionIterator = createSectionIterator({ data: 4, multiSection }); | ||
}); | ||
@@ -82,3 +82,3 @@ | ||
before(() => { | ||
isMultiSection = true; | ||
multiSection = true; | ||
}); | ||
@@ -88,3 +88,3 @@ | ||
before(() => { | ||
sectionIterator = createSectionIterator({ data: [0], isMultiSection }); | ||
sectionIterator = createSectionIterator({ data: [0], multiSection }); | ||
}); | ||
@@ -107,3 +107,3 @@ | ||
before(() => { | ||
sectionIterator = createSectionIterator({ data: [1], isMultiSection }); | ||
sectionIterator = createSectionIterator({ data: [1], multiSection }); | ||
}); | ||
@@ -129,3 +129,3 @@ | ||
before(() => { | ||
sectionIterator = createSectionIterator({ data: [4], isMultiSection }); | ||
sectionIterator = createSectionIterator({ data: [4], multiSection }); | ||
}); | ||
@@ -155,4 +155,4 @@ | ||
before(() => { | ||
isMultiSection = true; | ||
sectionIterator = createSectionIterator({ data: [2, 0, 0, 4, 1, 0, 3, 0], isMultiSection }); | ||
multiSection = true; | ||
sectionIterator = createSectionIterator({ data: [2, 0, 0, 4, 1, 0, 3, 0], multiSection }); | ||
}); | ||
@@ -159,0 +159,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14830