Classes
Methods
(generator, static) map(items, f)
Return a one-use generator that yields f(item) for each item of
items. One-use: the returned generator object is a one use or temporary
object.
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Iterable | items to use |
f |
function | mapping function |
Yields:
(static) partial(f, …args) → {function}
Return a partial function that behaves like f called with the provided
args. If any arguments are supplied in a call to the partial function, then
they will immediately follow args in the call to f. If you let g
denote a partial function of f, then a call to g(...supplied) will return
f(...args, ...supplied).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
f |
function | function to partially apply |
|
args |
* |
<repeatable> |
arguments to provide for partial application |
Returns:
(...supplied) => f(...args, ...supplied)
- Type
- function
Example
The following two line are equivalent:
const log = gaius.partial(console.log, '[gaius]');
const log = (...supplied) => console.log('[gaius]', ...supplied);
(generator, static) yielding(items)
Return a one-use generator that yields each item of items.
One-use: the returned generator object is a one use or temporary object.
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Iterable |