Skip to content

πŸ– a package applying mathematical transformations to arrays using functional programming concepts

Notifications You must be signed in to change notification settings

cm-gim/math-array-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

math-array-transform

A lightweight package that applies mathematical transformations to arrays using functional programming concepts.

Installation

You can install the package using npm:

npm i math-array-transform



Initialization

To use math-array-transform with ESM (ECMAScript Modules), you need to add the following configuration to your package.json file:

// package.json
{
    "type": "module"
}



Function

Applies a series of mathematical transformations to each element of the input array.

mapWithFunctions(arr, functionsArray);
  • arr: The input array.
  • functionsArray: An array of mathematical functions to apply to each element of the input array.



Usage

import { mapWithFunctions } from "math-array-transform";



Example

const arr = [1, 2, 3, 4, 5];
const FunctionsArray = [(n) => Math.pow(n, 2), (n) => Math.sqrt(n), (n) => Math.pow(n, 3)];

const resultArray = mapWithFunctions(arr, FunctionsArray);
console.log(resultArray); // [ 1, 8, 27, 64, 125 ]

About

πŸ– a package applying mathematical transformations to arrays using functional programming concepts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published