Skip to content

Commit

Permalink
version 0.1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed May 18, 2021
1 parent a89df9c commit 106f006
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 38 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
**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.24
# 0.1.25

- **New Feature**
- `Zipper`
- add `findIndex`, #80 (@SRachamim)
- add `findZ`, #80 (@SRachamim)

# 0.1.23

Expand Down
14 changes: 0 additions & 14 deletions docs/modules/Zipper.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Added in v0.1.6
- [deleteRight](#deleteright)
- [down](#down)
- [end](#end)
- [findZ](#findz)
- [insertLeft](#insertleft)
- [insertRight](#insertright)
- [modify](#modify)
Expand Down Expand Up @@ -288,19 +287,6 @@ export declare const end: <A>(fa: Zipper<A>) => Zipper<A>
Added in v0.1.6
## findZ
Moves focus to the nearest element matching the given predicate, preferring
the left, or `None` if no element matches.
**Signature**
```ts
export declare const findZ: <A>(p: Predicate<A>) => (fa: Zipper<A>) => O.Option<Zipper<A>>
```
Added in v0.1.24
## insertLeft
Inserts an element to the left of the focus and focuses on the new element.
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.24",
"version": "0.1.25",
"description": "A community driven utility package for fp-ts",
"main": "lib/index.js",
"module": "es6/index.js",
Expand Down
14 changes: 0 additions & 14 deletions src/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,6 @@ export const findIndex = <A>(predicate: Predicate<A>) => (fa: Zipper<A>): Option
)
)

/**
* Moves focus to the nearest element matching the given predicate, preferring
* the left, or `None` if no element matches.
*
* @category combinators
* @since 0.1.24
*/
export const findZ = <A>(p: Predicate<A>) => (fa: Zipper<A>): Option<Zipper<A>> =>
pipe(
fa,
findIndex(p),
O.chain((i) => (i === fa.lefts.length ? O.some(fa) : move(() => i, fa)))
)

/**
* Moves focus of the zipper up.
*
Expand Down
7 changes: 0 additions & 7 deletions test/Zipper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,4 @@ describe('Zipper', () => {
assert.deepStrictEqual(_.findIndex((x) => x === 'b')(_.make([], 'a', ['b', 'c'])), O.some(1))
assert.deepStrictEqual(_.findIndex((x) => x === 'b')(_.make([], 'a', [])), O.none)
})

it('findZ', () => {
assert.deepStrictEqual(_.findZ((a) => a === 0)(_.make([], 0, [])), O.some(_.make([], 0, [])))
assert.deepStrictEqual(_.findZ((a) => a === 1)(_.make([], 0, [])), O.none)
assert.deepStrictEqual(_.findZ((a) => a === 0)(_.make([0], 1, [])), O.some(_.make([], 0, [1])))
assert.deepStrictEqual(_.findZ((a) => a === 1)(_.make([], 0, [1])), O.some(_.make([0], 1, [])))
})
})

0 comments on commit 106f006

Please sign in to comment.