Skip to content

Commit

Permalink
Merge 7c2450f into a636938
Browse files Browse the repository at this point in the history
  • Loading branch information
abepeterkin committed Feb 26, 2018
2 parents a636938 + 7c2450f commit c603b3f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion packages/data-point/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ Example at: [examples/reducer-helper-find.js](examples/reducer-helper-find.js)

### <a name="reducer-constant">constant</a>

The **constant** reducer always returns the given value.
The **constant** reducer always returns the given value. If a reducer is passed it will not be evaluated.

**SYNOPSIS**

Expand Down Expand Up @@ -1211,6 +1211,34 @@ constant(value:*):*
```
</details>


<details>
<summary>reducers are not evaluated when defined inside of constants</summary>

```js
const { constant } = DataPoint.helpers

const input = {
b: 1
}

// ReducerObject that contains a ReducerPath ('$a')
let reducer = {
a: '$b'
}

dataPoint.resolve(reducer, input) // => { a: 1 }

// both the object and the path will be treated as
// constants instead of being used to create reducers
reducer = constant({
a: '$b'
})

dataPoint.resolve(reducer, input) // => { a: '$b' }
```
</details>

### <a name="reducer-parallel">parallel</a>

This resolves an array of reducers. The output is a new array where each element is the output of a reducer;
Expand Down

0 comments on commit c603b3f

Please sign in to comment.