Nice Pottery Mug

# This package has been deprecated

Author message:

`none`

## @kingjs/enumerable.odometer

1.0.2 • Public • Published

# @kingjs/enumerable.odometer

Generates arrays of odometer digits.

## Usage

A typical car odometer has 7 wheels, each wheel has 10 digits, and a new value is generated as the car moves along. These values can be generated for 11 units of distance like this:

```var odometer = require('@kingjs/enumerable.odometer')

var enumerable = odometer([10, 10, 10, 10, 10, 10, 10]);
var enumerator = enumerable.getEnumerator();

var actual = [];
for (var distance = 0; distance < 11; distance++) {
enumerator.moveNext();
var current = enumerator.current;
actual.push(current.reverse());
}

actual;```

result:

```[
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 2],
[0, 0, 0, 0, 0, 0, 3],
[0, 0, 0, 0, 0, 0, 4],
[0, 0, 0, 0, 0, 0, 5],
[0, 0, 0, 0, 0, 0, 6],
[0, 0, 0, 0, 0, 0, 7],
[0, 0, 0, 0, 0, 0, 8],
[0, 0, 0, 0, 0, 0, 9],
[0, 0, 0, 0, 0, 1, 0],
];```

## API

```function odometer(
bases?: number[]
): Enumerable```

### Parameters

• `bases`: an array of normal numbers specifying the number of digits on each wheel of the odometer at each position. May also be passed as an argument list.

### Return Value

Returns a sequence of arrays composed of the digits produced by an odometer of the specified number of digits and bases. The generator terminates after every combination has been generated.

## Remarks

A typical odometer increments digits from right to left however `odometer` increments from left to right so digits increment starting at index 0.

## Install

With npm installed, run

``````\$ npm install @kingjs/enumerable.odometer
``````

MIT

## Keywords

none

### Install

`npm i @kingjs/enumerable.odometer`

### Repository

github.com/kingces95/kingjs

1

1.0.2

MIT

4.21 kB

4