New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

labs-jsep

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

labs-jsep

a tiny JavaScript expression parser - modified by me (see github)

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-51.43%
Maintainers
1
Weekly downloads
 
Created
Source

##jsep: A Tiny JavaScript Expression Parser jsep is a simple expression parser written in JavaScript. It can parse JavaScript expressions but not operations. The difference between expressions and operations is akin to the difference between a cell in an Excel spreadsheet vs. a proper JavaScript program.

###Why jsep? I wanted a lightweight, tiny parser to be included in one of my other libraries. esprima and other parsers are great, but had more power than I need and were way too large to be included in a library that I wanted to keep relatively small.

jsep's output is almost identical to esprima's, which is in turn based on SpiderMonkey's.

###Custom Build First, install Grunt. While in the jsep project directory, run:

npm install .
grunt

The jsep built files will be in the build/ directory.

###Usage ####Client-side ... var parse_tree = jsep("1 + 1"); ####Node.JS First, run npm install jsep. Then, in your source file:

var jsep = require("jsep");
var parse_tree = jsep("1 + 1");

####Custom Operators // Add a custom ^ binary operator with precedence 10 jsep.addBinaryOp("^", 10);

// Add a custom @ unary operator with precedence 10
jsep.addUnaryOp('@');

// Remove a binary operator
jsep.removeBinaryOp(">>>");

// Remove a unary operator
jsep.removeUnaryOp("~");

###License jsep is under the MIT license. See LICENSE file.

###Thanks Some parts of the latest version of jsep were adapted from the esprima parser.

FAQs

Package last updated on 23 Apr 2017

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