Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afeiship/next-step
Get current/next/previous step data.
https://github.com/afeiship/next-step
actions current next previous step
Last synced: 22 days ago
JSON representation
Get current/next/previous step data.
- Host: GitHub
- URL: https://github.com/afeiship/next-step
- Owner: afeiship
- License: mit
- Created: 2016-05-18T09:18:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-09T01:36:52.000Z (over 3 years ago)
- Last Synced: 2024-10-12T14:58:34.383Z (about 1 month ago)
- Topics: actions, current, next, previous, step
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-step
> Get current/next/previous step data.[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]## installation
```bash
npm install -S @jswork/next-step
```## usage
```js
import '@jswork/next-step';const items = [
{
id: 15,
status: 'W',
student: { id: 3, realname: '小明', photo: 'default-avatar.png' }
},
{
id: 65,
status: 'R',
student: { id: 7, realname: '测试3号', photo: 'default-avatar.png' }
},
{ id: 115, status: 'R', student: { id: 8, realname: 'H彩', photo: 'default-avatar.png' } }
];const result1 = nx.step(items, {
callback: (item) => item.id === 15,
get: (item) => nx.get(item, 'id', null)
});const result2 = nx.step(items, {
callback: (item) => item.id === 65,
get: (item) => nx.get(item, 'id', null)
});const result3 = nx.step(items, {
callback: (item) => item.id === 115,
get: (item) => nx.get(item, 'id', null)
});// result1 is: { current: 15, previous: null, next: 65 }
// result2 is: { current: 65, previous: 15, next: 115 }
// result3 is: { current: 115, previous: 65, next: null }
```## license
Code released under [the MIT license](https://github.com/afeiship/next-step/blob/master/LICENSE.txt).[version-image]: https://img.shields.io/npm/v/@jswork/next-step
[version-url]: https://npmjs.org/package/@jswork/next-step[license-image]: https://img.shields.io/npm/l/@jswork/next-step
[license-url]: https://github.com/afeiship/next-step/blob/master/LICENSE.txt[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-step
[size-url]: https://github.com/afeiship/next-step/blob/master/dist/next-step.min.js[download-image]: https://img.shields.io/npm/dm/@jswork/next-step
[download-url]: https://www.npmjs.com/package/@jswork/next-step