Skip to content

API

The module exports two functions cook amd partial. The latter only to create specializations of the cooking.

cook

Derive an array of objects from pairs that map population samples to distinct features.

The default (but optional) validation ensures:

  • population and pairs both are non-empty arrays of non-null values
  • features are unique (first elements of pairs)
  • pairs second entries only provide members of population

Parameters

  • population array array with all members of the population.
  • sample string key mapping to the sample from the population.
  • feature string key mapping to the feature variations.
  • pairs array pairs of features and array of samples (null for final pair).
  • force bool (false does / true does not) validate use. (optional, default false)

Returns array of objects that map population samples to distinct features.

partial

Partially apply to a function the first argument and return specialization.

Parameters

  • func function function to be specialized.
  • first string value to be fixed as first positional argument.

Returns function function with the first argument primed.