array-mumu 0.2.0-rc.5

Array tools plugin for the Mumu ecosystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
extend("test")
extend("array")

describe("array:chunk", () => {
  it("chunks into equal parts", () => {
    expect_equal(array:chunk(2, [1,2,3,4]), [[1,2],[3,4]])
  })
  it("last chunk may be smaller", () => {
    expect_equal(array:chunk(3, [1,2,3,4,5]), [[1,2,3],[4,5]])
  })
  it("works for strings", () => {
    expect_equal(array:chunk(2, ["a","b","c"]), [["a","b"],["c"]])
  })
})