1.2.2 • Published 2 years ago

strapi-parse v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Version

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

$ npm i --save strapi-parse
import { strapiParse } from "strapi-parse";

const parsedAPIResponse = strapiParse(strapiAPIResponse);

Examples

strapi-parse does not currently support getting data from the meta properties

Collection Type

// 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

License

MIT License

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago