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 🙏

© 2025 – Pkg Stats / Ryan Hefner

excel-functions

v1.0.1

Published

A lightweight, fully typed TypeScript library that brings the power of **Excel-like functions** to your JavaScript and TypeScript projects. Whether you're building financial calculators, data analysis tools, or engineering applications, this library has y

Readme

Excel Functions in TypeScript 🚀

A lightweight, fully typed TypeScript library that brings the power of Excel-like functions to your JavaScript and TypeScript projects. Whether you're building financial calculators, data analysis tools, or engineering applications, this library has you covered with mathematical, logical, text, date, financial, and engineering functions.


Features ✨

  • Mathematical Functions: Perform calculations like SUM, AVERAGE, ROUND, MEDIAN, and more.
  • Text Functions: Manipulate strings with CONCATENATE, FIND, SEARCH, and more.
  • Date Functions: Calculate working days with NETWORKDAYS.
  • Financial Functions: Compute PV, NPV, IRR, and RATE for financial analysis.
  • Engineering Functions: Convert units, binary, hexadecimal, and create complex numbers.
  • Fully Typed: Built with TypeScript for excellent developer experience and type safety.

Installation 📦

Install the package via npm:

npm install excel-functions-ts

Or via yarn:

yarn add excel-functions-ts

Quick Start 🚀

Importing the Functions

You can import the functions as needed:

import {
  MathFunctions,
  TextFunctions,
  DateTimeFunctions,
  FinancialFunctions,
  EngineeringFunctions
} from 'excel-functions-ts';

Examples

1. Mathematical Functions

// Sum of numbers
const sum = MathFunctions.SUM(1, 2, 3); // 6

// Average of numbers
const avg = MathFunctions.AVERAGE(1, 2, 3); // 2

// Round a number
const rounded = MathFunctions.ROUND(3.14159, 2); // 3.14

// Calculate the median
const median = MathFunctions.MEDIAN(1, 2, 3, 4, 5); // 3

// Calculate the standard deviation
const stdev = MathFunctions.STDEV(1, 2, 3, 4, 5); // 1.4142

2. Text Functions

// Find the position of a substring
const position = TextFunctions.FIND("Hello World", "World"); // 6

// Concatenate strings
const combined = TextFunctions.CONCATENATE("Hello", " ", "World"); // "Hello World"

3. Date and Time Functions

// Calculate working days between two dates
const startDate = new Date(2023, 9, 1);
const endDate = new Date(2023, 9, 31);
const holidays = [new Date(2023, 9, 10)];
const workingDays = DateTimeFunctions.NETWORKDAYS(startDate, endDate, holidays); // 21

4. Financial Functions

// Calculate the present value of an investment
const pv = FinancialFunctions.PV(0.05, 10, 1000); // 7721.73

// Calculate the net present value of cash flows
const npv = FinancialFunctions.NPV(0.05, -1000, 200, 300, 400); // -62.85

// Calculate the internal rate of return
const irr = FinancialFunctions.IRR(-1000, 200, 300, 400); // 0.12

5. Engineering Functions

// Convert binary to decimal
const decimal = EngineeringFunctions.BIN2DEC("1010"); // 10

// Convert hexadecimal to decimal
const hexToDec = EngineeringFunctions.HEX2DEC("A"); // 10

// Create a complex number
const complex = EngineeringFunctions.COMPLEX(3, 4); // "3 + 4i"

API Documentation 📚

Mathematical Functions

  • SUM(...args: number[]): number: Calculates the sum of numbers.
  • AVERAGE(...args: number[]): number: Calculates the average of numbers.
  • ROUND(value: number, decimals: number = 0): number: Rounds a number to a specified number of decimal places.
  • MEDIAN(...args: number[]): number: Calculates the median of a set of numbers.
  • STDEV(...args: number[]): number: Calculates the standard deviation of a set of numbers.

Text Functions

  • FIND(text: string, substring: string, startPosition: number = 0): number: Finds the position of a substring (case-sensitive).
  • CONCATENATE(...args: string[]): string: Combines multiple strings into one.

Date and Time Functions

  • NETWORKDAYS(startDate: Date, endDate: Date, holidays: Date[] = []): number: Calculates the number of working days between two dates.

Financial Functions

  • PV(rate: number, periods: number, payment: number): number: Calculates the present value of an investment.
  • NPV(rate: number, ...cashFlows: number[]): number: Calculates the net present value of cash flows.
  • IRR(...cashFlows: number[]): number: Calculates the internal rate of return for cash flows.

Engineering Functions

  • BIN2DEC(binary: string): number: Converts a binary number to decimal.
  • HEX2DEC(hex: string): number: Converts a hexadecimal number to decimal.
  • COMPLEX(real: number, imaginary: number): string: Creates a complex number.

Why Use This Library? 🤔

  • Lightweight: No dependencies, minimal footprint.
  • Type-Safe: Built with TypeScript for better developer experience.
  • Excel-Like: Familiar functions for Excel users.
  • Versatile: Suitable for financial, engineering, and data analysis applications.

Contributing 🤝

We welcome contributions! If you'd like to add new functions, improve documentation, or fix bugs, please:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/YourFeature.
  3. Commit your changes: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/YourFeature.
  5. Open a pull request.

License 📄

This project is licensed under the MIT License


Support 💖

If you find this library useful, please consider giving it a ⭐️ on GitHub. Your support helps us improve and maintain the project!


Happy coding! 🎉