Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

section-iterator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

section-iterator - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

6

dist/sectionIterator.js

@@ -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 @@

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