GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jspreadsheet/formula-basic

BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
dist
dist
 
 
src
src
 
 
test
test
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc
.prettierrc
 
 
README.md
README.md
 
 
index.html
index.html
 
 
mocha.config.js
mocha.config.js
 
 
package.json
package.json
 
 
webpack.config.js
webpack.config.js
 
 

Repository files navigation

Formula

Formula Basic is an expression evaluator designed to handle Excel Formulas. It utilizes the formulajs/formulajs library function to process and calculate these Formulas.

Installation

npm

To install in your project using npm, run the following command:

$ npm i @jspreadsheet/formula

CDN

To use Formula via a CDN, include the following script tags in your HTML file:

<script src="https://jsuites.net/v4/jsuites.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@formulajs/formulajs/lib/browser/formula.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@jspreadsheet/formula/dist/index.min.js"></script>

Usage

After installation, Formula can be utilized in your code by requiring it into your JavaScript file.

const formula = require('@jspreadsheet/formula')

Doing basic math operations:

formula('1 + 1')
// result -> 2
formula('2 * (4 + 4)')
// result -> 16
formula('10/(1+1)')
// result -> 5
formula('10**2')
// result -> 100

Using excel formulas:

formula('SUM(2, 2, 4)')
// result -> 8
formula('AVERAGE(50, 55, 60)')
// result -> 55
formula('TODAY()')

Variables can be defined to use in the second argument of the function, for example:

// Random variable
formula('HEYYOU', { HEYYOU: 5 })
// result -> 5
formula('HELLO + WORLD', { HELLO: 2, WORLD: -4 })
// result -> -2

// Excel cell names
formula('A1 + A2', { A1: 2, A2: 2 })
// result -> 4
formula('SUM(A1, A2, A3)', { A1: 6, A2: 5, A3: 10 })
// result -> 21
formula('COUNT(A1:B2)', { A1: 1, A2: 1, B1: 1, B2: null })
// result -> 3

The syntax A1:A5 generates an array consisting of the values found by the formula for each A in the range from 1 to 5, in this case: [A1, A2, A3, A4, A5].

Development

Running the project

To run the project in development mode, use the following commands:

$ npm i
$ npm start

This will start a web-server with formula available in console, as a playground.

Running Tests

After installing the packages run:

$ npm run test

To see more details in a browser:

$ npm run test:browser

To have more information about test coverage:

$ npm run test:coverage

Contributing

Formula basic is an open source project and contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.

Ensure that you run the formatting plugins to maintain consistent code patterns. You can use the following command to do that:

$ npm run format

License

Formula basic is released under the MIT.

About

No description, website, or topics provided.

Resources

Readme
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.