Skip to content

🧰 Toolbox of useful parsers to use when working with Contentful API responses.

License

Notifications You must be signed in to change notification settings

SublimeProphets/contentful-parsers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧰 contentful-parsers

npm version npm Coverage Status CircleCI Greenkeeper badge

Toolbox of useful parsers to use when working with Contentful API responses.

Install

Via npm

npm install contentful-parsers

Via Yarn

yarn add contentful-parsers

Parsers

fieldsParser

Probably the most common parser of the lot. This will take a Contentful response, either an array or a single item, and parse the items to flatten all of the fields objects and remove the majority of the sys objects, except for a reference to the sys.contentType.sys.id, in case you are doing any based on that for your rendering.

How to use

import contentful from 'contentful';
import { fieldsParser } from 'contentful-parsers';


const client = contentful.createClient({
  space: '[SPACE_ID]',
  accessToken: '[ACCESS_TOKEN]',
});

const response = await client.getEntry('[ENTRY_ID]');
const data = fieldsParser(response);

Input

Coming soon

Output

Coming soon

License

MIT © Ryan Hefner

About

🧰 Toolbox of useful parsers to use when working with Contentful API responses.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%