Socket
Book a DemoInstallSign in
Socket

chaiscript

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chaiscript

JavaScript port of ChaiScript, an easy to use embedded scripting language.

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ChaiScript.js

JavaScript port of ChaiScript, an easy to use embedded scripting language, powered through Emscripten.

Node.js

npm init
npm install chaiscript --save
// Load the ChaiScript module.
const chaiscript = require('chaiscript')

// Create the Chai instance.
const chai = new chaiscript.ChaiScript()

// Get some code to use.
const code = `
	def hello(name) {
		return "Hello " + name
	}

	var output = hello("Bob")
	print(output)
`

// Run the code through the ChaiScript instance.
chai.eval(code)

// Make sure to clean up when you're done.
chai.delete()

API

new chaiscript.ChaiScript()

Create a new ChaiScript environment

.eval(string)

Executes the given code.

.evalString(string)

Executes the given code, and returns the output as a string.

FAQs

Package last updated on 26 Jan 2019

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