inner-join

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
N/A
Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list
1 contributor
Install inner-join as a package?
Copied
npm i @bit/justin-capalbo.ramda.inner-join
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
innerJoin (
pred:Function,
xs:Array,
ys:Array
) : Array

Takes a predicate pred, a list xs, and a list ys, and returns a list xs' comprising each of the elements of xs which is equal to one or more elements of ys according to pred.

pred must be a binary function expecting an element from each list.

xs, ys, and xs' are treated as sets, semantically, so ordering should not be significant, but since xs' is ordered the implementation guarantees that its values are in the same order as they appear in xs. Duplicates are not removed, so xs' may contain duplicates if xs contains duplicates.

Example
R.innerJoin(
       (record, id) => record.id === id,
       [{id: 824, name: 'Richie Furay'},
        {id: 956, name: 'Dewey Martin'},
        {id: 313, name: 'Bruce Palmer'},
        {id: 456, name: 'Stephen Stills'},
        {id: 177, name: 'Neil Young'}],
       [177, 456, 999]
     );
     //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}]
Arguments
pred: Function
xs: Array
ys: Array
Returns
Array

Help and resources