From 0dd2bc13c127b326248d0bd7c6f70bfbe0ef7760 Mon Sep 17 00:00:00 2001 From: Brandon Blaylock Date: Sat, 16 Mar 2024 17:39:23 -0700 Subject: [PATCH] release: 2.1.1 * bump release to 2.1.1. * modify iterable partition to use filter and predicate --- deno.json | 2 +- iterable.ts | 18 ++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/deno.json b/deno.json index a38ead1..4ebafdb 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@baetheus/fun", - "version": "2.1.0", + "version": "2.1.1", "exports": { "./applicable": "./applicable.ts", "./array": "./array.ts", diff --git a/iterable.ts b/iterable.ts index 2f54fb3..4527160 100644 --- a/iterable.ts +++ b/iterable.ts @@ -38,6 +38,8 @@ import { isSome } from "./option.ts"; import { isLeft, isRight } from "./either.ts"; import { createBind, createTap } from "./flatmappable.ts"; import { createBindTo } from "./mappable.ts"; +import { pipe } from "./fn.ts"; +import { not } from "./predicate.ts"; /** * @since 2.0.0 @@ -260,20 +262,8 @@ export function partition( return (ua) => { const cloned = clone(ua); return [ - iterable(function* partitionFirst() { - for (const a of cloned) { - if (predicate(a)) { - yield a; - } - } - }), - iterable(function* partitionSecond() { - for (const a of cloned) { - if (!predicate(a)) { - yield a; - } - } - }), + pipe(cloned, filter(predicate)), + pipe(cloned, filter(not(predicate))), ]; }; }