Skip to content

Commit

Permalink
issue-#57, issue-#61 - Updated 'at' method to ecmascript version of m…
Browse files Browse the repository at this point in the history
…ethod.
  • Loading branch information
elycruz committed Dec 13, 2022
1 parent 13713f8 commit e06f0a8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/fjl/src/list/at.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {$lookup, lookup} from "../object/lookup";

export const

$at = $lookup,
/**
* Gets item at index; Same as` [].at()` (allows negative/right-to-left indexing (see mdn Array.at method).
*/
export const at = <T>(i: number, xs: T[]): T => xs.at(i),

/**
* Gets item at index.
* Curried version of `at`.
*/
at = lookup;
$at = <T>(i: number) => (xs: T[]): T => xs.at(i);

0 comments on commit e06f0a8

Please sign in to comment.