🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@bignum/template-compiler

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bignum/template-compiler

A compiler that compiles template literals for calculation.

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
46
142.11%
Maintainers
1
Weekly downloads
 
Created
Source

@bignum/template-compiler

Low-level compiler for calculation template literals.

đź’ż Installation

npm install @bignum/template-compiler

đź“– Usage

import { compile } from "@bignum/template-compiler";

const compiled = compile(["", " + 2 * 3"]);
const context = {
  binaryOperations: {
    "+": (a, b) => Number(a) + Number(b),
    "*": (a, b) => Number(a) * Number(b),
  },
};

console.log(compiled([1], context)); // 7

đź§® API

compile(templateElements)

Compiles the static string parts of a tagged template literal into an executable function.

The returned function accepts:

  • params: the substitution values from the template literal.
  • context: an object that defines the operators, variables, and functions used during evaluation.

Keywords

formula

FAQs

Package last updated on 10 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts