Skip to main content

relay-id

Small package containing helpers for encoding/decoding ids according to the relay specification Version

Installation

NPM

npm install @availity/relay-id

Yarn

yarn add @availity/relay-id

Usage

import { fromGlobalId, toGlobalId } from '@availity/relay-id';

// Will return {type: 'User', id: '789'}
const { type, id } = fromGlobalId('VXNlcjo3ODk=');

// Will return global id of VXNlcjo3ODk=
const globalId = toGlobalId('User', '789');