Skip to the content

Tane種

Reproduce numbers from a seed, shuffle or pick items, share a daily puzzle and resume a saved stream.

Tane means seed in Japanese. About the name

Contents

Reference · Streams, draws and seeds

checkBlocksfunction

The blocks in ascending order, checked: whole numbers, inside 1 to most, none overlapping another. Throws a RangeError naming the first fault.

Import it

import { checkBlocks } from "@johnmorrisdotca/tane";

Definition

function checkBlocks(blocks: readonly SeedBlock[], most?: number): SeedBlock[]

Parameters

NameTypeDescription
blocksreadonly SeedBlock[]

The reserved blocks to validate and sort.

most (optional)number

The largest seed admitted by the host.

Returns

SeedBlock[]

The blocks in ascending order, checked: whole numbers, inside 1 to most, none overlapping another. Throws a RangeError naming the first fault.

Examples

import { checkBlocks } from "@johnmorrisdotca/tane";

console.log(checkBlocks([{ from: 1000, size: 100 }, { from: 10, size: 5 }]));
[ { from: 10, size: 5 }, { from: 1000, size: 100 } ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tane 1.3.0.