npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pyx-industries/vc-render-template-utils

v1.1.0

Published

A lightweight utility library for constructing, extracting and rendering verifiable credential render templates.

Readme

vc-render-template-utils

A lightweight utility library for constructing, extracting and rendering verifiable credential render templates.

Installation

Install the package:

# Yarn
yarn add @pyx-industries/vc-render-template-utils

# NPM
npm install @pyx-industries/vc-render-template-utils

Usage

Basic Example

import {
  constructRenderMethod,
  extractRenderTemplate,
  populateTemplate,
  RenderMethodType,
  TemplatingEngineType,
} from '@pyx-industries/vc-render-template-utils';

// Construct a render method
const template = '<div>Hello, {{name}}!</div>';
const renderMethod = constructRenderMethod(
  template,
  RenderMethodType.RenderTemplate2024,
);

// Extract the template
const extractedTemplate = await extractRenderTemplate(renderMethod);

// Populate the template with data
const data = { name: 'World' };
const result = populateTemplate(
  TemplatingEngineType.Handlebars,
  extractedTemplate,
  data,
);

console.log(result); // Output: <div>Hello, World!</div>

Advanced Example with URL Fetching

import {
  constructRenderMethod,
  extractRenderTemplate,
  populateTemplate,
  RenderMethodType,
  TemplatingEngineType,
} from '@pyx-industries/vc-render-template-utils';

// Construct a render method with a URL
const renderMethod = constructRenderMethod(
  '',
  RenderMethodType.RenderTemplate2024,
  { url: 'http://example.com/template.html' },
);

// Extract the template from the URL
const extractedTemplate = await extractRenderTemplate(renderMethod);

// Populate the template
const data = { title: 'My Page' };
const result = populateTemplate(
  TemplatingEngineType.Handlebars,
  extractedTemplate,
  data,
);

console.log(result); // Output: Rendered template content

API

constructRenderMethod

constructRenderMethod(template: string, renderMethodType: RenderMethodType, extra?: Record<string, unknown>)

Constructs a render method object for the specified template and type.

  • template: The template string or empty if using a URL.
  • renderMethodType: Either RenderTemplate2024 or WebRenderingTemplate2022.
  • extra: Optional metadata (e.g., url or mediaQuery).

extractRenderTemplate

extractRenderTemplate(renderMethod: RenderMethod)

Extracts the template content, fetching from a URL if necessary.

  • renderMethod: The render method object created by constructRenderMethod.

populateTemplate

populateTemplate(templatingEngineType: TemplatingEngineType, template: string, data: Record<string, unknown>)

Populates the template with data using the specified templating engine.

  • templatingEngineType: Currently supports Handlebars.
  • template: The template string to populate.
  • data: The data object to populate the template.

Supported Render Methods

  • RenderTemplate2024: Supports remote and embedded templates.
  • WebRenderingTemplate2022: Designed for embedded templates.

Supported Templating Engines

  • Handlebars: A robust templating engine for dynamic content.

Development

Prerequisites

  • Node.js (v22, as specified in .nvmrc)
  • yarn

Setup

  1. Clone the repository:

    git clone https://github.com/pyx-industries/vc-render-template-utils.git
    cd vc-render-template-utils
  2. Install dependencies:

    yarn install
  3. Build the project:

    yarn build
  4. Run tests:

    yarn test

Scripts

  • yarn build: Compiles TypeScript to JavaScript.
  • yarn test: Runs Jest tests.
  • yarn test:ci: Runs tests with coverage.
  • yarn format: Checks code formatting with Prettier.
  • yarn format:fix: Auto-fixes formatting issues.
  • yarn lint: Runs ESLint.
  • yarn lint:fix: Auto-fixes linting issues.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -m 'Add your feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a pull request.

Ensure your code adheres to the project's linting and formatting standards by running yarn lint and yarn format.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Issues

Report bugs or suggest features by opening an issue on the GitHub Issues page.