Skip to content

Commit

Permalink
issue-#57 - Progress on idiomatic curry - Converted methods up to './…
Browse files Browse the repository at this point in the history
…src/object/isset'.
  • Loading branch information
elycruz committed Aug 9, 2022
1 parent f8bbffe commit 3f05bcf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/fjl/src/errorThrowing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type ErrorIfNotTypesThrower<T> = (

export type ErrorMessageCtxToString = (errorMessageCtx: ErrorMessageCtx) => string;

export type TypeCheckerPred<TRef extends TypeRef, T> = ((typeRef: TRef, x: T) => boolean) | CurryOf2<TRef, T, boolean>;
export type TypeCheckerPred<TRef extends TypeRef, T> = ((typeRef: TRef, x: T) => boolean);

export const

Expand Down
6 changes: 3 additions & 3 deletions packages/fjl/src/object/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import {typeOf} from './typeOf';
import {instanceOf, $instanceOf, keys} from '../platform/object';
import {curry, CurryOf2} from '../function/curry';
import {length} from "../list/length";
import {isset} from './isset';
import {TypeRef, Unary} from "../types";
Expand Down Expand Up @@ -100,7 +99,8 @@ export const
*/
isType = <T>(type: TypeRef | any, obj: T): boolean => typeOf(obj) === toTypeRefName(type),

$isType =curry(isType) as CurryOf2<any, any, boolean>,
$isType = <T>(type: TypeRef | any) =>
(obj: T): boolean => isType(type, obj),

/**
* Synonym for `isType` (or just a more accurate name for `isType`).
Expand Down Expand Up @@ -137,7 +137,7 @@ export const
* @param x {*} - Value to check.
* @returns {Boolean}
*/
isOfType = curry((type, x) => isType(type, x) || instanceOf(type, x)) as CurryOf2<any, any, boolean>,
isOfType = (type, x) => isType(type, x) || instanceOf(type, x),

/**
* Synonym for `isOfType` (or just a more accurate name).
Expand Down

0 comments on commit 3f05bcf

Please sign in to comment.