Skip to content

Commit

Permalink
feat@inner.join
Browse files Browse the repository at this point in the history
  • Loading branch information
Deyan Totev committed Jan 13, 2024
1 parent 118d2b0 commit 5ab014f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
8 changes: 5 additions & 3 deletions NEXT_VERSION_CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
sync lenses types with ramda

- innerJoin
- gt
- gte
- reduceBy
- hasIn

go to source definition in vscode works better for ramda than for rambda
---
https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
---

---
test for which cases - ts, js

---
such types as `SortObjectPredicate` need to be exported
---
Expand All @@ -27,6 +28,7 @@ issue with gh release
---
throttle should accept 0 arguments, i.e. no need to force unary function
---
splitWith
R.pickWith
R.pickAllWith - maybe
---
Expand Down
44 changes: 39 additions & 5 deletions source/innerJoin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
export function innerJoin(foo, bar) {
if (arguments.length === 1){
return (_bar) => innerJoin(foo, _bar);
import { curry } from './curry.js'

function _includesWith(
pred, x, list
){
let idx = 0
const len = list.length

while (idx < len){
if (pred(x, list[ idx ]))
return true

idx += 1
}

return
}
return false
}
function _filter(fn, list){
let idx = 0
const len = list.length
const result = []

while (idx < len){
if (fn(list[ idx ]))
result[ result.length ] = list[ idx ]

idx += 1
}

return result
}

export function innerJoinFn(
pred, xs, ys
){
return _filter(x => _includesWith(
pred, x, ys
), xs)
}

export const innerJoin = curry(innerJoinFn)
2 changes: 0 additions & 2 deletions source/innerJoin.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { innerJoin as innerJoinRamda } from 'ramda'

import { innerJoin } from './innerJoin.js'

const a = {
Expand Down

0 comments on commit 5ab014f

Please sign in to comment.