const jshiki = require('jshiki')

const expressionSource = '`Hello! My name\'s ${name}`'

const expression = jshiki.parse(expressionSource)

expression({ name: 'Azumi' })

Lightweight and safe expression evaluation

Evaluate Javascript expressions safely and easily with jshiki's simple API.

Get Started GitHub

What is jshiki?

jshiki is a lightweight, single-dependency library for evaluating expressions in JavaScript. jshiki only lets expressions access data you explicitly provide, and also provides rule-based access control that lets you determine what data is accessible.

Simple API

You can get started with jshiki in just a few lines of code. Just require or import jshiki and use the evaluate or parse functions!

Lightweight

jshiki only has one dependency: acorn, a small, fast Javascript parser.

Worry-free

jshiki only allows expressions to access data you explicitly provide them with, and denies access to globals or the use of assignment.

Additionally, you can configure rules that determine which properties of objects are accessible and which aren't using an easy-to-use syntax.