Skip to content

Commit

Permalink
fix: use vite and vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
ritesh404 committed Dec 14, 2024
1 parent 4f5fae6 commit fbd53aa
Show file tree
Hide file tree
Showing 33 changed files with 5,298 additions and 25,711 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: Release NPM Package

on:
push:
branches:
- main
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: "12.x"
- run: npm ci
- run: npm test
- run: npm run build --if-present
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: "18.x"
- run: npm ci
- run: npm test
- run: npm run build --if-present
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Tests
on: push

jobs:
lint:
name: Run tests
runs-on: ubuntu-latest
container: 'node:12-alpine'
steps:
- uses: actions/checkout@v1
- run: npm ci
- run: npm test
lint:
name: Run tests
runs-on: ubuntu-latest
container: "node:18-alpine"
steps:
- uses: actions/checkout@v1
- run: npm ci
- run: npm test
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ const kudoJS = require("fp-kudojs")
```
import kudoJS from "fp-kudojs"
```
### IIFE
```
<script src="/path/to/kudo.iife.js"></script>
```
### Import single entities using CommonJS
```
const compose = require("fp-kudojs/function/compose");
Expand Down
119 changes: 64 additions & 55 deletions docs/pair.md
Original file line number Diff line number Diff line change
@@ -1,139 +1,146 @@

<a name="Pair"></a>

# Pair

A Pair is another way of storing two values in a single value. Elements of a Pair do not need to be of the same type

**Implements:** <code>[BiFunctor](https://github.com/fantasyland/fantasy-land#bifunctor)</code>, <code>[Monad](https://github.com/fantasyland/fantasy-land#monad)</code>, <code>[Semigroup](https://github.com/fantasyland/fantasy-land#semigroup)</code>, <code>[Setoid](https://github.com/fantasyland/fantasy-land#setoid)</code>

- [Pair](#pair)
- [Pair(v1, v2)](#pairv1-v2)
- [Pair.of(v)](#pairofv)
- [Pair.equals(j)](#pairequalsj)
- [Pair.concat( p)](#pairconcat-p)
- [Pair.fst()](#pairfst)
- [Pair.snd()](#pairsnd)
- [Pair.concat(j)](#pairconcatj)
- [Pair.getValue()](#pairgetvalue)
- [Pair.map(f)](#pairmapf)
- [Pair.bimap(f1, f2)](#pairbimapf1-f2)
- [Pair.chain(f)](#pairchainf)
- [Pair.swap()](#pairswap)
- [Pair.toString()](#pairtostring)
- [Examples](#examples)
- [Pair](#pair)
- [Pair(v1, v2)](#pairv1-v2)
- [Pair.of(v)](#pairofv)
- [Pair.equals(j)](#pairequalsj)
- [Pair.concat( p)](#pairconcat-p)
- [Pair.fst()](#pairfst)
- [Pair.snd()](#pairsnd)
- [Pair.concat(j)](#pairconcatj)
- [Pair.getValue()](#pairgetvalue)
- [Pair.map(f)](#pairmapf)
- [Pair.bimap(f1, f2)](#pairbimapf1-f2)
- [Pair.chain(f)](#pairchainf)
- [Pair.swap()](#pairswap)
- [Pair.toString()](#pairtostring)
- [Examples](#examples)

<a name="new_Pair_new"></a>

### Pair(v1, v2)
Pair constructor

Pair constructor

| Param | Type | Description |
| --- | --- | --- |
| v1 | <code>any</code> | First element of the Pair |
| v2 | <code>any</code> | second element of the Pair |
| Param | Type | Description |
| ----- | ---------------- | -------------------------- |
| v1 | <code>any</code> | First element of the Pair |
| v2 | <code>any</code> | second element of the Pair |

<a name="Pair.of"></a>

### Pair.of(v)
Pair constructor

Pair constructor

| Param | Type | Description |
| --- | --- | --- |
| v | <code>any</code> | Element that will be stored as first and second element of the Pair |
| Param | Type | Description |
| ----- | ---------------- | ------------------------------------------------------------------- |
| v | <code>any</code> | Element that will be stored as first and second element of the Pair |

<a name="Pair.equals"></a>

### Pair.equals(j)
Check if the values of the current pair is equal to the values of the passed Pair. Pairs are equal only if the first and second values of both Pairs are equal

Check if the values of the current pair is equal to the values of the passed Pair. Pairs are equal only if the first and second values of both Pairs are equal

| Param | Type | Description |
| --- | --- | --- |
| j | [<code>Pair</code>](#Pair) | The Pair to compare with |
| Param | Type | Description |
| ----- | -------------------------- | ------------------------ |
| j | [<code>Pair</code>](#Pair) | The Pair to compare with |

<a name="Pair.concat"></a>

### Pair.concat( p)
Concat the current pair with the passed one. Note that both first and second elements of the Pair should be of type semigroup for cancat to work

Concat the current pair with the passed one. Note that both first and second elements of the Pair should be of type semigroup for cancat to work

| Param | Type | Description |
| --- | --- | --- |
| p | [<code>Pair</code>](#Pair) | Pair to concat |
| Param | Type | Description |
| ----- | -------------------------- | -------------- |
| p | [<code>Pair</code>](#Pair) | Pair to concat |

<a name="Pair.fst"></a>

### Pair.fst()

Get the first element of the Pair

<a name="Pair.snd"></a>

### Pair.snd()

Get the second element of the Pair

<a name="Pair.concat"></a>

### Pair.concat(j)
Applies the function inside the second element of the passed Pair to the current Pair and concats the first element of the second Pair to the first element of the current Pair

Applies the function inside the second element of the passed Pair to the current Pair and concats the first element of the second Pair to the first element of the current Pair

| Param | Type | Description |
| --- | --- | --- |
| j | [<code>Pair</code>](#Pair) | Pair with function as the second element |
| Param | Type | Description |
| ----- | -------------------------- | ---------------------------------------- |
| j | [<code>Pair</code>](#Pair) | Pair with function as the second element |

<a name="Pair.getValue"></a>

### Pair.getValue()

Get the values within the Pair as an Array of length 2

<a name="Pair.map"></a>

### Pair.map(f)
Apply the function to the second element of the current Pair

Apply the function to the second element of the current Pair

| Param | Type | Description |
| --- | --- | --- |
| f | <code>function</code> | Function |
| Param | Type | Description |
| ----- | --------------------- | ----------- |
| f | <code>function</code> | Function |

<a name="Pair.bimap"></a>

### Pair.bimap(f1, f2)
Apply f1 to the first element and f2 to the second element of the current Pair

Apply f1 to the first element and f2 to the second element of the current Pair

| Param | Type | Description |
| --- | --- | --- |
| f1 | <code>function</code> | Function to be applied on the first element |
| f2 | <code>function</code> | Function to be applied on the second element |
| Param | Type | Description |
| ----- | --------------------- | -------------------------------------------- |
| f1 | <code>function</code> | Function to be applied on the first element |
| f2 | <code>function</code> | Function to be applied on the second element |

<a name="Pair.chain"></a>

### Pair.chain(f)
Chain together many computations that return a Pair

Chain together many computations that return a Pair

| Param | Type | Description |
| --- | --- | --- |
| f | <code>function</code> | Function that returns another Pair |
| Param | Type | Description |
| ----- | --------------------- | ---------------------------------- |
| f | <code>function</code> | Function that returns another Pair |

<a name="Pair.swap"></a>

### Pair.swap()

Swap the elements of the current pair

<a name="Pair.toString"></a>

### Pair.toString()
Get a stringified version of the Pair

Get a stringified version of the Pair

---

### Examples
Lets construct some Pairs
```

Lets construct some Pairs

```
import {Pair} from "fp-kudojs";
const point1 = Pair(1, 2);
Expand All @@ -144,6 +151,7 @@ console.log(point2.toString()); // Pair((2), (2))
```

Two Pairs are equal if the first and the second element of each Pair are equal

```
console.log(point1.equals(Pair(1,2))) //true
Expand All @@ -154,14 +162,15 @@ console.log(Pair([1], [2]).equals(Pair([1],[2]))) //false
```

Concat Pairs. Note that to concat pairs the elements of each Pair should be semigroups of the same type

```
const p1 = Pair([1], [2]);
const p2 = Pair([3], [4]);
const p3 = p1.concat(p2);
console.log(p3.getValue()); // [[1, 3], [2, 4]]
console.log(p3.getValue()); // [[1, 3], [2, 4]]
```

** TODO: Add more examples **
** TODO: Add more examples **
Loading

0 comments on commit fbd53aa

Please sign in to comment.