# Search

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

## Usage

#### Install

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

#### Import

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

#### Usage

Example Data

```javascript
const data = [
  {
    userId: 1,
    id: 3,
    title: "ea nesciunt repelut",
    body:
      "et iusto sed quo iure voluptatem occaecati"
  },
  {
    userId: 1,
    id: 4,
    title: "eum et est occaecati",
    body:
      "ullam et saepe voluptatem rerum illo velit"
  },
  {
    userId: 1,
    id: 5,
    title: "quas odio",
    body:
      "repudiandae veniam nesciunt quaerat sunt sed\nalias "
  }
];
```

### Basic Syntax

Search on single field

```javascript
search(data, key, field, options?);
```

Search on multiple field

```javascript
search(data, key, [field, otherField], options?);
```

**Options**

```javascript
{ caseSensitive: false }
```

**Sample**

```javascript
search(data, "nesciunt", ["title", "body"]);
```

Output

```javascript
[
  {
    "userId": 1,
    "id": 3,
    "title": "ea nesciunt repelut",
    "body": "et iusto sed quo iure voluptatem occaecati"
  },
  {
    "userId": 1,
    "id": 5,
    "title": "quas odio",
    "body": "repudiandae veniam nesciunt quaerat sunt sed\nalias "
  }
]
```


---

# 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/search.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.
