1.0.2 • Published 6 months ago

math-array-transform v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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 ]
1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago