Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsep

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsep

a tiny JavaScript expression parser

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4M
increased by18.34%
Maintainers
3
Weekly downloads
 
Created

What is jsep?

JSEP (JavaScript Expression Parser) is a lightweight JavaScript library that parses JavaScript expressions into an abstract syntax tree (AST). It is useful for evaluating expressions, building interpreters, or creating domain-specific languages.

What are jsep's main functionalities?

Parsing Expressions

JSEP can parse a string expression into an abstract syntax tree (AST). This is useful for analyzing or transforming expressions.

const jsep = require('jsep');
const ast = jsep('a + b * (c - d)');
console.log(JSON.stringify(ast, null, 2));

Custom Operators

JSEP allows you to add custom operators to the parser. This is useful for extending the language to support new operations.

const jsep = require('jsep');
jsep.addBinaryOp('**', 10);
const ast = jsep('a ** b');
console.log(JSON.stringify(ast, null, 2));

Custom Functions

JSEP allows you to add custom functions to the parser. This is useful for extending the language to support new functions.

const jsep = require('jsep');
jsep.addUnaryOp('sqrt');
const ast = jsep('sqrt(a)');
console.log(JSON.stringify(ast, null, 2));

Other packages similar to jsep

FAQs

Package last updated on 05 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc