Skip to main content

A set of helpers used to create dynamic mocks for camouflage mocking lib.

This package works with Node.js
This package works with Node.js
JSR Score
88%
Published
4 months ago (0.1.4)
class Helpers

Creates a Helper class which exposes methods

  • To register/unregister helpers
  • To add/remove custom helpers
  • To enable/disable inject helper

Constructors

new
Helpers(
injectionAllowed?: boolean,
loglevel?: LogLevel | "off",
)

Properties

addHelper: (
name: string,
fn: Handlebars.HelperDelegate,
) => void

Allow registration of a custom helper:

parse: (
content: string,
contextVariables?: Record<any, any>,
) => string

Parses a provided template to a string using an optional context

removeHelper: (name: string) => void

Allow removal of a registered custom helper:

setInjectionAllowed: (allowed: boolean) => void

Allows enabling/disabling of inject helper

private
registerDefaultHelpers: () => void

Registers all the default helpers and conditionally registers inject helper

Add Package

npx jsr add @camouflage/helpers

Import symbol

import module from "@camouflage/helpers";

Add Package

yarn dlx jsr add @camouflage/helpers

Import symbol

import module from "@camouflage/helpers";

Add Package

pnpm dlx jsr add @camouflage/helpers

Import symbol

import module from "@camouflage/helpers";