Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thejohnfreeman/transformers

A suite of composable transformations.
https://github.com/thejohnfreeman/transformers

Last synced: 21 days ago
JSON representation

A suite of composable transformations.

Awesome Lists containing this project

README

        

## transformers
A suite of composable transformations.

* [transformers](#module_transformers)
* _static_
* [.at(path, transformer)](#module_transformers.at) ⇒ transformer
* [.get(...path)](#module_transformers.get) ⇒ transformer
* [.hide(...keys)](#module_transformers.hide) ⇒ transformer
* [.later(path, format)](#module_transformers.later) ⇒ compareFunction
* [.map(transformer)](#module_transformers.map) ⇒ transformer
* [.object(mapping)](#module_transformers.object) ⇒ transformer
* [.on(f, g)](#module_transformers.on) ⇒ function
* [.sequence(...transformers)](#module_transformers.sequence) ⇒ transformer
* [.sortBy(compare)](#module_transformers.sortBy) ⇒ transformer
* [.take(n)](#module_transformers.take) ⇒ transformer
* _inner_
* [~transformer](#module_transformers..transformer) ⇒ U
* [~compareFunction](#module_transformers..compareFunction) ⇒ number

### transformers.at(path, transformer) ⇒ transformer
Walk down a path through an object and transform the end.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type | Description |
| --- | --- | --- |
| path | Array.<string> | A path into the object. |
| transformer | transformer | |

### transformers.get(...path) ⇒ transformer
Walk down a path through an object an return the end.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| ...path | string |

### transformers.hide(...keys) ⇒ transformer
Hide keys in an object.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| ...keys | string |

### transformers.later(path, format) ⇒ compareFunction
Return a comparison function for reverse chronological order.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type | Description |
| --- | --- | --- |
| path | Array.<string> | A path into an object. |
| format | string | [A Moment format.](http://momentjs.com/docs/#/parsing/string-format/) |

### transformers.map(transformer) ⇒ transformer
Transform every item in an array.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| transformer | transformer |

### transformers.object(mapping) ⇒ transformer
Construct a new object.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type | Description |
| --- | --- | --- |
| mapping | object | A map from keys to transformers. Each transformer should return the value for that key. |

### transformers.on(f, g) ⇒ function
Map two arguments with one function and then pass those results to
another.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| f | function |
| g | function |

### transformers.sequence(...transformers) ⇒ transformer
Compose transformers in order.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| ...transformers | transformers |

### transformers.sortBy(compare) ⇒ transformer
Sort array ordered by a comparison function.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| compare | compareFunction |

### transformers.take(n) ⇒ transformer
Return first `n` items in array.

**Kind**: static method of [transformers](#module_transformers)

| Param | Type |
| --- | --- |
| n | number |

### transformers~transformer ⇒ U
A transformation.

**Kind**: inner typedef of [transformers](#module_transformers)

| Type |
| --- |
| T |

### transformers~compareFunction ⇒ number
Compare two values and return their ordering.

**Kind**: inner typedef of [transformers](#module_transformers)
**Returns**: number - - A negative, zero, or positive number.
**See**: [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)

| Param | Type |
| --- | --- |
| a | T |
| b | T |