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

@dtable/formula

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dtable/formula

dtable-formula

  • 1.0.19
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
2
Weekly downloads
 
Created
Source

Welcome to @dtable/formula 👋

Version License: ISC

dtable-formula

Install

npm install --save @dtable/formula

Run tests

npm run test

Examples

List some simple examples for quick start.

prase text expression

import { formula } from "@dtable/formula";

formula("1 + 2"); // 3

get lexer result

import { tokenize } from "@dtable/formula";

tokenize("1 + 2");

// [
//   { image: "1", tokenType: { name: "Number" } },
//   { image: "+", tokenType: { name: "Plus" } },
//   { image: "2", tokenType: { name: "Number" } },
// ];

use params

import { formula } from "@dtable/formula";

formula("{Number1} + {Number2}", { Number1: 1, Number2: 2 }); // 3

All Functions And Operators

NameTypeDescription
{}Param operatorreference to a param.
!=Logical operatorCheck if one value is not equal to another value.
=Logical operatorCompare if one value is equal to another value.
>=Logical operatorCompare if one value is greater than, or equal to, another value.
>Logical operatorCompare if one value is greater than another value
<=Logical operatorCompare if one value is less than, or equal to, another value.
<Logical operatorCompare if one value is less than another value.
IF()Logical functionIt allows you to make logical comparisons between a value and what you expect
+Numeric operatorAdd together two values.
-Numeric operatorSubtract two values.
*Numeric operatorMultiply two values.
/Numeric operatorDivide two values.
ABS()Numeric functionReturns the absolute value.
ROUND()Numeric functionRounds the value to the number of decimal places given by precision.
ROUNDUP()Numeric functionRounds the value to the number of decimal places given by precision, always rounding up.
ROUNDDOWN()Numeric functionRounds the value to the number of decimal places given by precision, always rounding down.
INT()Numeric functionReturns the greatest integer that is less than or equal to the specified value.
MAX()Numeric functionReturns the largest of the given numbers.
MIN()Numeric functionReturns the smallest of the given numbers.
&Strings operatorConcatenate strings.
CONCATENATE()Strings functionConcatenate strings.
REPT()Strings functionRepeats text a given number of times.
LEN()Strings functionGet the length of the string
DATETIME_FORMAT()Date functionReformat the data from the date-type field into a string of your specifications
SET_TIMEZONE()Date functionSet the time zone for the date

Author

👤 zhangchao1997

Keywords

FAQs

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