1.0.2 • Published 1 year ago

math-in-one v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

math-in-one PRs Welcome

Introduction

This package includes the following functionalities🐻

  • Sum: This method can take multiple parameter or Array and return sum of all numbers or digits of array.

  • Product: This method can take multiple parameter or Array and return product of all numbers or digits of array.

  • Random Text: This method can take 4 parameter and return random text. Bydefault it return random digits of 6 length.

  • Average: This method can take multiple parameter or Array and return product of all numbers or digits of array.

  • Flatten Array: This method can take a nested array and return 1-D array.

Installation

npm install math-in-one

OR

npm i math-in-one

Usage Guidelines

   import Maths from 'math-in-one'

Random Text

To generate random text call method randomtext()

randomtext(length,alphaNumeric,allowUppercase,allowLowercase,alpha)

If no parameter pass in above method then it will return 6 digit of random text. It accept 4 parameter :-

length :- Length of random text accepted. Default (6)

alphaNumeric :- If need to generate alphaNumeric text then proivde it true. Default (false)

allowUppercase :- If need to generate character in upper case proivde it true. Default (false)

allowLowercase :- If need to generate character in lower case proivde it true. Default (false)

alpha :- If need to generate only character proivde it true. Default (false)

It will return Number/ AlphaNumeric/ Alphabet..

TABLE

Argument As InputInput String ExampleDescriptionDefault
length5This is for generating random text of length {12395}6
alphaNumerictrueThis is for genereating alphanumeric {12gf9}false
allowUppercasetrueThis is for generate characters in upprecase {12GF9}false
allowLowercasetrueThis is for generate characters in upprecase {12gf9}false
alphatrueThis is for generate only charactersfalse

Examples :-

Sum:

console.log(Maths.sum(8,2,3,4,5));
// output :- 22

Maths.sum([8,2,3,4,5[);
// output :- 22

Product:

console.log(Maths.product(8,2,3,4,5));
// output :- 960

console.log(Maths.sum([8,2,3,4,5]));
// output :- 960

Random Text:

Maths.randomtext(8,true,true,true,false)
// output :- QMIV2AHV

Average:

console.log(Maths.average(1, 2, 3, 4));
// output :- 10

console.log(Maths.average([1, 2, 3, 4]));
// output :- 10

Flatten:

console.log(Maths.flatten([1,[2,[23,34,[5,6,7,8]], 4]]));

// output :- [
  1, 2, 23, 34, 5,
  6, 7,  8,  4
]

Build

npm run build

Contribute

If you would like to contribute your most welcome. Clone the repository. 🐻

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago