# strapi-parse

> Parse Strapi V4 API responses into easier to work with objects

Latest version **1.2.2** (published 2022-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install strapi-parse
pnpm add strapi-parse
yarn add strapi-parse
bun add strapi-parse
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2022-04-21 |
| First published | 2022-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Joshua Henry |
| Maintainers | jch-code |

## Links

- npm: https://www.npmjs.com/package/strapi-parse
- Repository: https://github.com/jch-code/strapi-parse
- Homepage: https://github.com/jch-code/strapi-parse#readme
- Issues: https://github.com/jch-code/strapi-parse/issues
- npm.io page: https://npm.io/package/strapi-parse

## Recent versions

- 1.2.2 (latest) — 2022-04-21
- 1.2.1 — 2022-04-21
- 1.2.0 — 2022-01-12
- 1.1.0 — 2022-01-12
- 1.0.6 — 2022-01-10
- 1.0.5 — 2022-01-10
- 1.0.4 — 2022-01-10
- 1.0.3 — 2022-01-10
- 1.0.2 — 2022-01-10
- 1.0.1 — 2022-01-10
- 1.0.0 — 2022-01-10

## README

![Version](https://img.shields.io/badge/version-1.2.2-blue.svg?cacheSeconds=2592000)

# strapi-parse

strapi-parse is an NPM package that can be used to parse Strapi V4 API responses into easier to work with objects.

## Usage

```sh
$ npm i --save strapi-parse
```

```javascript
import { strapiParse } from "strapi-parse";

const parsedAPIResponse = strapiParse(strapiAPIResponse);
```

## Examples
> strapi-parse does not currently support getting data from the meta properties
### Collection Type
```javascript
// Strapi API Response
{
  data: [
    {
      id: 1,
      attributes: {
        title: "Test Article",
        slug: "test-article",
        // ...
      }
    },
    {
      id: 2,
      attributes: {
        title: "Test Article 2",
        slug: "test-article-2",
        // ...
      }
    }
  ],
  meta: {
    // ...
  }
}

// strapi-parse Output
[
  {
    id: 1
    title: "Test Article",
    slug: "test-article",
    // ...
  },
  {
    id: 2
    title: "Test Article 2",
    slug: "test-article-2",
    // ...
  }
]
```
### Single Type
```javascript
// Strapi API Response
{
  data: {
      id: 1,
      attributes: {
          title: "Test Article",
          slug: "test-article",
          // ...
      },
      meta: {
          availableLocales: []
      }
  },
  meta: { }
}

// strapi-parse Output
{
  id: 1
  title: "Test Article",
  slug: "test-article",
  // ...
}
```

## Author
Joshua Henry - [@jch-code](https://github.com/jch-code)

## License
[MIT License](https://github.com/jch-code/strapi-parse/blob/main/LICENSE)

---
_Source: https://npm.io/package/strapi-parse · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
