1.0.0 • Published 2 years ago

@jswork/next-activeable-data-list v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

next-activeable-data-list

Next data list with active index.

version license size download

installation

npm install -S @jswork/next-activeable-data-list

apis

apiparamsdescription
get-Get current active item.
to-Go to the input index.
next-Go to next index.
prev-Go to previous index.
first-Go to first index.
last-Go to last index.

options

{ activeIndex: 0, continuous: false }

usage

import NxActiveableDataList from '@jswork/next-activeable-data-list';

const items = [
  "item1",
  "item2",
  "item3",
  "item4",
  "item5",
  "item6",
  "item7",
  "item8",
  "item9",
];

const list = new NxActiveableDataList();

list.next();    // 1
list.next();    // 2
list.prev();    // 1
list.prev();    // 0

license

Code released under the MIT license.