This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add index, nth and last helpers
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { index } from "../index" | ||
|
||
describe("index", () => { | ||
test("gets the index item in an array", () => { | ||
expect(index(0)([0, 1])).toBe(0) | ||
}) | ||
|
||
test("gets the index item in an empty array", () => { | ||
expect(index(0)([])).toBe(undefined) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { last } from "../index" | ||
|
||
describe("last", () => { | ||
test("gets the last item in an array", () => { | ||
expect(last([0, 1])).toBe(1) | ||
}) | ||
|
||
test("gets the last item in an empty array", () => { | ||
expect(last([])).toBe(undefined) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { nth } from "../index" | ||
|
||
describe("nth", () => { | ||
test("gets the nth item in an array", () => { | ||
expect(nth(1)([0, 1])).toBe(0) | ||
}) | ||
|
||
test("gets the nth item in an empty array", () => { | ||
expect(nth(1)([])).toBe(undefined) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters