Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Create rows from an array with no bullshit! 😎

License

hamxabaig/rows-from-array

Repository files navigation

rows-from-array Build Status

Create rows from an array with no bullshit! 😎

Install

$ npm install rows-from-array

Usage

const createRows = require('rows-from-array');
createRows([1, 2, 3, 4, 5, 6], {rowLength: 2});
//=> [[1, 2], [3, 4], [5, 6]]

API

createRows(arr, [options])

arr

Type: Array

The Array to convert into rows

options

Type: Object

rowLength

Type: number
Default: 2

The length of the rows to divide the array into. Each element will be this length array.

fillRow

Type: any
Default: N/A

Used to fill the array rows if the length is uneven. For instance,

createRows([1, 2, 3, 4, 5, 6, 7], {rowLength: 3, fillRow: 0});
//=> [[1, 2, 3], [4, 5, 6], [7, 0, 0]]

Related

License

MIT Β© Made with ❀️ & β˜•οΈ by Hamza Baig

About

Create rows from an array with no bullshit! 😎

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /