# InnerJoin

[Github](https://github.com/aykutkardas/Json-Function) repository for your stars.

## Usage

#### Install

```bash
$ npm install json-function
```

#### Import

```javascript
import { innerJoin } from 'json-function';
```

#### Usage

Example Data

```javascript
const data = [
  {
    id: 1,
    userId: 1,
    title: "delectus aut autem",
  },
  {
    id: 2,
    userId: 2,
    title: "quis ut nam facilis et officia qui",
  }
];

const data2 = [
  {
    id: 1,
    firstName: "John"
  },
  {
    id: 2,
    firstName: "Mike"
  }
];
```

Syntax

```javascript
innerJoin(data, data2, "userId", "id");

// innerJoin([data, [otherData, [dataField, [otherDataField]]]])
```

Output

```javascript
[
  {
    id: 1,
    userId: 1,
    title: "delectus aut autem",
    firstName: "John"
  },
  {
    id: 2,
    userId: 2,
    title: "quis ut nam facilis et officia qui",
    firstName: "Mike"
  }
];
```

{% hint style="danger" %}
&#x20;If two arrays have the same fields, the fields of the second given array are used.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://worn.gitbook.io/json-function/functions/inner-join.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
