apollo-client-transform
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Apollo Client Transformers

Build Status code style: prettier

This package is useful for when you have scalars, but you receive them serialized on the client and you don't really want to do the deserialisation in your view layer.

Install

npm i -S apollo-client-transformers

Usage

import { createTransformerLink } from 'apollo-client-transformers';
 
const DateTransformer = {
  parseValue(time) {
    return new Date(time);
  },
};
 
const transformers = {
  User: {
    createdAt: DateTransformer,
  },
};
 
const transformerLink = createTransformerLink(transformers);
 
// You can now concatenate it with your http link before creating the client like so:
const enhancedHttpLink = transformerLink.concat(httpLink);

Readme

Keywords

none

Package Sidebar

Install

npm i apollo-client-transform

Weekly Downloads

247

Version

0.1.0

License

MIT

Unpacked Size

32.4 kB

Total Files

17

Last publish

Collaborators

  • cultofcoders