@digitalcredentials/open-badges-context

中文文档
3.0.0发布于 2025/05/22MITESM + CJS零依赖近 30 天下载 8万

NPM package for the OBv3 (Open Badges version 3) JSON-LD context.

原始使用文档
文档目录7 节
  1. Table of Contents
  2. Background
  3. Install
  4. Usage
  5. API
  6. Developing
  7. License

OpenBadges v3 Context (@digitalcredentials/open-badges-context)

Node.js CI NPM Version

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

Usage

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 object

This package can be used with bundlers, such as webpack, in browser applications.

API

The library exports the following properties:

  • Various OBv3 @context URLs, such as: CONTEXT_URL_V3, CONTEXT_URL_V3_0_0, CONTEXT_URL_V3_0_3 etc.
  • contexts: A Map that 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:

  1. Add the new context file to js/contexts
  2. Update js/index.js
  3. Update rollup.config.js with the new exports
  4. Update context.spec.js with the new exports
  5. Update README / Usage section.

License

版本与发布记录

@digitalcredentials/open-badges-context 共发布 8 个版本,首次发布于 2022/05/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.0.0latest2025/05/221.5 年前
2.1.02024/01/242 年前
2.0.12023/07/173 年前
2.0.02023/07/173 年前
1.0.02022/12/013 年前
0.1.22022/10/274 年前

关于 @digitalcredentials/open-badges-context 的常见问题

@digitalcredentials/open-badges-context 是什么?

NPM package for the OBv3 (Open Badges version 3) JSON-LD context.

如何安装 @digitalcredentials/open-badges-context?

在项目目录运行 npm install @digitalcredentials/open-badges-context,或使用 pnpm add / yarn add / bun add。

@digitalcredentials/open-badges-context 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/digitalcredentials__open-badges-context 是否存在。

@digitalcredentials/open-badges-context 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@digitalcredentials/open-badges-context 可以商用吗?

@digitalcredentials/open-badges-context 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@digitalcredentials/open-badges-context 的下载量有多少?

根据 npm 官方下载统计,@digitalcredentials/open-badges-context 在 2026/10/12 – 2026/11/10 这 30 天内被下载 79,778 次,日均约 2,659 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@digitalcredentials/open-badges-context 还在维护吗?

最新版本 3.0.0 发布于 2025/05/22(1.5 年前);至今共发布 8 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/05/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。