Skip to content

Commit

Permalink
version 0.1.26
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed May 21, 2021
1 parent fe33055 commit 0231b9c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
**Note**: Gaps between patch versions are faulty/broken releases.
**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice.

# 0.1.26

- **New Feature**
- `Zipper`
- add `moveByFindFirst`, #81 (@SRachamim)

# 0.1.25

- **New Feature**
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Zipper.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ no element matches, `None` is returned. If an element matches,
export declare const moveByFindFirst: <A>(predicate: Predicate<A>) => (fa: Zipper<A>) => O.Option<Zipper<A>>
```
Added in v0.1.25
Added in v0.1.26
## start
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fp-ts-contrib",
"version": "0.1.25",
"version": "0.1.26",
"description": "A community driven utility package for fp-ts",
"main": "lib/index.js",
"module": "es6/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export const findIndex = <A>(predicate: Predicate<A>) => (fa: Zipper<A>): Option
* `Some<Zipper<A>>` is returned.
*
* @category combinators
* @since 0.1.25
* @since 0.1.26
*/
export const moveByFindFirst = <A>(predicate: Predicate<A>) => (fa: Zipper<A>): Option<Zipper<A>> =>
pipe(
Expand Down
11 changes: 10 additions & 1 deletion test/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,18 @@ describe('Zipper', () => {
})

it('moveByFindFirst', () => {
assert.deepStrictEqual(_.moveByFindFirst((a) => a === 0)(_.make([], 0, [])), O.some(_.make([], 0, [])))
const zipper = _.make([], 0, [])
assert.deepStrictEqual(
pipe(
zipper,
_.moveByFindFirst((a) => a === 0),
O.exists((z) => z === zipper)
),
true
)
assert.deepStrictEqual(_.moveByFindFirst((a) => a === 1)(_.make([], 0, [])), O.none)
assert.deepStrictEqual(_.moveByFindFirst((a) => a === 0)(_.make([0], 1, [])), O.some(_.make([], 0, [1])))
assert.deepStrictEqual(_.moveByFindFirst((a) => a === 1)(_.make([], 0, [1])), O.some(_.make([0], 1, [])))
assert.deepStrictEqual(_.moveByFindFirst((a) => a === 1)(_.make([1], 0, [1])), O.some(_.make([], 1, [0, 1])))
})
})

0 comments on commit 0231b9c

Please sign in to comment.