zigzag-traverse
v1.0.0
Published
zigzag-order traversal
Downloads
16
Maintainers
Readme
zigzag-traverse
zigzag-order traversal
Install
# using npm
npm install --save zigzag-traverse
# using yarn
yarn add zigzag-traverse
Usage
const zigzag_traverse = require('zigzag-traverse');
zigzag_traverse([
0, 1, 2, 3, 4,
5, 6, 7, 8, 9,
10, 11, 12, 13, 14,
15, 16, 17, 18, 19,
], 5, value => console.log(value));
//=> 0 1 5 10 6 2 3 7 11 15 16 12 8 4 9 13 17 18 14 19
API
declare function zigzag_traverse<T, U extends ArrayLike<T>>(
array: U,
width: number,
callback: (value: T, index: number, array: U) => void,
): void;
export = zigzag_traverse;
Development
# lint
yarn run lint
# build
yarn run build
# test
yarn run test
License
MIT © Ika