Coder Social home page Coder Social logo

lmammino / financial Goto Github PK

View Code? Open in Web Editor NEW
691.0 14.0 19.0 246 KB

A Zero-dependency TypeScript/JavaScript financial library (based on numpy-financial) for Node.js, Deno and the browser

Home Page: https://financialjs.netlify.app/

License: MIT License

JavaScript 0.97% TypeScript 99.03%
financial mortgage numpy-financial numpy typescript javascript nodejs node zero-dependency deno

financial's Introduction

Financial

npm version CI codecov Documentation

A Zero-Dependency TypeScript / JavaScript financial utility library inspired by numpy-financial that can be used on Node.js, Deno, Bun and the browser.

It does support the same functionality offered by numpy-financial but it only supports scalar JavaScript number values (NO numpy-like array values) and it does NOT support arbitrary-precision signed decimal numbers (such as decimal.js, big.js or bignumber.js).

๐Ÿ“– API DOCS ๐Ÿ“– : financialjs.netlify.app

Example usage in a picture

Install

With npm:

npm install --save-dev financial

Or, with yarn:

yarn add financial

Example usage

import { fv } from 'financial'

fv(0.05 / 12, 10 * 12, -100, -100) // 15692.928894335748

Module formats

This library exports its functionality using different module formats.

Commonjs

const financial = require('financial') // ./index.js

// use `financial.fv`, `financial.pmt`, etc.

or, leveraging destructuring

const { fv, pmt } = require('financial') // ./index.js

// use `fv`, `pmt`, etc.

An optimized Commonjs for browsers can be imported directly from the web:

<script src="https://www.npmcdn.com/[email protected]/dist/financial.cjs.production.min.js"></script>

Note: make sure you replace the x.y.z with the correct version you want to use.

ESM (EcmaScript Modules)

Also working with Typescript

import { fv, pmt } from 'financial'

// use `fv`, `pmt`, etc.

There's no default export in the ESM implementation, so you have to explicitely import the functionality you need, one by one.

Use with Deno

Make sure you specify the version you prefer in the import URL:

import { assertEquals } from 'https://deno.land/std/testing/asserts.ts'
import * as f from 'https://deno.land/x/npm:[email protected]/src/financial.ts'

assertEquals(f.fv(0.05 / 12, 10 * 12, -100, -100), 15692.928894335755)

Implemented functions and Documentation

Click on the function name to get the full documentation for every function, or check out the full programmatic documentation at financialjs.netlify.app.

Local Development

Below is a list of commands you will probably find useful.

  • npm start or yarn start: Runs the project in development/watch mode. Your project will be rebuilt upon changes.
  • npm run build or yarn build: Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple format (CommonJS, UMD, and ES Module).
  • npm run build:docs or yarn build:docs: Builds the API documentation in the docs folder using typedoc.
  • npm test or yarn test: Runs the test watcher (Jest) in an interactive mode. it runs tests related to files changed since the last commit.
  • npm run test:watch or yarn test:watch: runs the tests in watch mode

Test with Deno

To test with Deno, run:

deno test test/deno.ts

Contributing

Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.

You can also submit PRs as long as you adhere with the code standards and write tests for the proposed changes.

License

Licensed under MIT License. ยฉ Luciano Mammino.

financial's People

Contributors

belovsandr avatar dependabot[bot] avatar lmammino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

financial's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.