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

math-literal

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-literal

Math Literal -----

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Math Literal

BigNumber.add(BigNumber.div(BigNumber.plus(a, BigNumber.times(b, c)), d), e)

Or

math`(${a} + ${b} * ${c}) / ${d} + ${e}`

I like the second one. ^^

there is also mathIs that returns a boolean

mathIs`abs(${a}) > ${b}`

Available Operators

Arithmetic Operators
  • + : Addition
  • - : Subtraction
  • * or x : Multiplication
  • / : Division
  • ** or ^ : Exponentiation
Special Arithmetic Operators
  • << : Left move decimals (equivalent to multiplying by a power of 10)
  • >> : Right move decimals (equivalent to dividing by a power of 10)
Unary Operators
  • - : Negation (when used before a number or expression)
Functions
  • round(x) : Round to the nearest integer
  • floor(x) : Round down to the nearest integer
  • ceil(x) : Round up to the nearest integer
  • sqrt(x) : Square root
  • abs(x) : Absolute value
  • ln(x) : Natural logarithm
  • exp(x) : Exponential function (e^x)
  • max(x, y) : Maximum of two values
  • min(x, y) : Minimum of two values
Comparison Operators (for mathIs)
  • > : Greater than
  • >= : Greater than or equal to
  • < : Less than
  • <= : Less than or equal to
  • === or == : Equal to
  • !== or != : Not equal to
Logical Operators (for mathIs)
  • && : Logical AND
  • || : Logical OR
Grouping
  • ( ) : Parentheses for grouping expressions and function arguments

Note: The order of operations follows standard mathematical conventions, with functions and parentheses having the highest precedence, followed by exponents, multiplication/division, and then addition/subtraction.

FAQs

Package last updated on 25 Oct 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