npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

financial

v0.2.4

Published

A Zero-dependency TypeScript/JavaScript port of numpy-financial

Downloads

27,150

Readme

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.