1.0.9 • Published 3 years ago

ironarrays v1.0.9

Weekly downloads
12
License
ISC
Repository
-
Last release
3 years ago

IronHack Array Helpers

npm package to help with complete your ironhack web-dev course with minimal code.

Usage.

import the package into your file

in the root of your project in terminal run command:

npm i ironarrays

require it in your files you want to use:

const ironarrays = require("ironarrays")

Examples of usage :

const myArray = [1,2,3,4,5]

const myStr = "the quick brown fox jumped over the lazy dog"

functions:

  • sum

for use with arrays of numbers, it sums every element and returns a single value

ironarrays.sum(myArray);

// returns 15

  • square

for use with arrays of numbers, it squares every value and returns an array

ironarrays.square(myArray);

// returns [1,4,9,16,25]

  • cube

for use with arrays of numbers, it cubes every value and returns an array

ironarrays.cube(myArray);

// returns [1, 8, 27, 64, 125]

  • longestWord

accepts a string and returns the longest word and the amount of charachters it contains

ironarrays.longestWord(myStr);

// returns "The longest word is "jumped" with 6 characters"

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago