diff --git a/CHANGELOG.md b/CHANGELOG.md index a075d5f..8eee6d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/modules/Zipper.ts.md b/docs/modules/Zipper.ts.md index f08c18d..7817e22 100644 --- a/docs/modules/Zipper.ts.md +++ b/docs/modules/Zipper.ts.md @@ -49,7 +49,6 @@ Added in v0.1.6 - [deleteRight](#deleteright) - [down](#down) - [end](#end) - - [findZ](#findz) - [insertLeft](#insertleft) - [insertRight](#insertright) - [modify](#modify) @@ -288,19 +287,6 @@ export declare const end: (fa: Zipper) => Zipper 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: (p: Predicate) => (fa: Zipper) => O.Option> -``` - -Added in v0.1.24 - ## insertLeft Inserts an element to the left of the focus and focuses on the new element. diff --git a/package.json b/package.json index e099e8a..6fb4540 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Zipper.ts b/src/Zipper.ts index efe729a..9bb2718 100644 --- a/src/Zipper.ts +++ b/src/Zipper.ts @@ -201,20 +201,6 @@ export const findIndex = (predicate: Predicate) => (fa: Zipper): 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 = (p: Predicate) => (fa: Zipper): Option> => - pipe( - fa, - findIndex(p), - O.chain((i) => (i === fa.lefts.length ? O.some(fa) : move(() => i, fa))) - ) - /** * Moves focus of the zipper up. * diff --git a/test/Zipper.ts b/test/Zipper.ts index c5b7449..f949c1d 100644 --- a/test/Zipper.ts +++ b/test/Zipper.ts @@ -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, []))) - }) })