# Select

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

## Usage

#### Install

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

#### Import

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

#### Usage

Example Data

```javascript
const data = [
  {
    firstname: "John",
    lastname: "Doe",
    book: {
      id: 0,
      title: "Book Name"
    }
  },
  {
    firstname: "Johnny",
    lastname: "Doe",
    book: {
      id: 1,
      title: "Book Name 2"
    }
  }
];
```

### Single Field Select Syntax

```javascript
select(data, "firstname");
```

Output

```javascript
const data = [
  {
    firstname: "John",
  },
  {
    firstname: "Johnny",
  }
];
```

### Multiple Field Select Syntax

```javascript
select(data, ["firstname", "lastname"]);
```

Output

```javascript
const data = [
  {
    firstname: "John",
    lastname: "Doe",
  },
  {
    firstname: "Johnny",
    lastname: "Doe",
  }
];
```


---

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