Socket
Book a DemoInstallSign in
Socket

cycle-chunk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cycle-chunk

Cycle through an array indefinetly providing a chunk of custom size per iteration. Usefull in showing slideshows, panels, tabs and so forth.

0.0.1
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

cycle-chunk build status

Cycle through an array indefinetly providing a chunk of custom size per iteration. Usefull in showing slideshows, panels, tabs and so forth.

Install:

npm i cycle-chunk

Example:

import CycleChunk from 'cycle-chunk'

const cyclechunk = new CycleChunk([1,2,3,4,5,6,7], 3)
  
cyclechunk.next() == [1,2,3]
cyclechunk.next() == [4,5,6]
cyclechunk.next() == [7,1,2]

cyclechunk.prev() == [4,5,6])
cyclechunk.prev() == [1,2,3])
cyclechunk.prev() == [5,6,7])

API

class CycleChunk<T> extends Array

constructor(array:T[], size?: number = 0, startIndex?: number = 0)

next():T[]

prev():T[]

current():T[]

public reversed: IterableIterator<T[]>

public * [Symbol.iterator]():IterableIterator<T[]>

FAQs

Package last updated on 04 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.