1.0.0 • Published 10 months ago

@ironmaiden59/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Lotide

A mini clone of the Lodash library.

Purpose

BEWARE: This library was published for learning purposes. It is not intended for use in production-grade software.

This project was created and published by me as part of my learnings at Lighthouse Labs.

Usage

Install it:

npm install @ironmaiden59/lotide

Require it:

const _ = require('@ironmaiden59/lotide');

Call it:

const results = _.tail([1, 2, 3]) // => [2, 3]

Documentation

The following functions are currently implemented:

  • head(array): Function to return the first element of an input array. Takes an array as a param and returns element at index 0
  • tail(array): Function to return a new array with all elements except the first. Takes an array as a parameter and returns a new array starting from index 1 to the end.
  • middle(array): Function to return the middle element(s) of an array. Takes an array as a parameter and returns a new array with the middle element(s) of the input array. If the input array has an odd length, a single middle element is returned. If the input array has an even length, two middle elements are returned.
  • eqArrays(array1, array2): Function to check if two arrays are equal. Takes two arrays as parameters and returns a boolean value indicating whether the two arrays are equal in terms of their elements and order.
  • assertEqual(actual, expected): Function to assert if two values are equal. Takes two values as parameters and logs a message indicating whether they are equal or not.
1.0.0

10 months ago