@digitalcredentials/open-badges-context
v3.0.0
Published
NPM package for the OBv3 (Open Badges version 3) JSON-LD context.
Keywords
Readme
OpenBadges v3 Context (@digitalcredentials/open-badges-context)
NPM package for the OBv3 (Open Badges version 3) JSON-LD context.
Table of Contents
Background
For use with JSON-LD document loaders (such as
the DCC security-document-loader
or DigitalBazaar's jsonld-document-loader).
Install
Requires Node.js 14+
To install via NPM:
npm install @digitalcredentials/open-badges-contextUsage
import obCtx from '@digitalcredentials/open-badges-context';
// or
const obCtx = require('@digitalcredentials/open-badges-context');
obCtx.CONTEXT_URL_V3
// 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json' <-- Latest URL
// get context data for a specific context
obCtx.contexts.get(obCtx.CONTEXT_URL_V3)
// full context objectThis package can be used with bundlers, such as webpack, in browser applications.
API
The library exports the following properties:
- Various OBv3
@contextURLs, such as:CONTEXT_URL_V3,CONTEXT_URL_V3_0_0,CONTEXT_URL_V3_0_3etc. contexts: AMapthat maps URLs to full context data.
See index.js for full list of exports.
Developing
When adding a new @context, do all of the following:
- Add the new context file to
js/contexts - Update
js/index.js - Update
rollup.config.jswith the new exports - Update
context.spec.jswith the new exports - Update README / Usage section.
