1.0.0 • Published 3 years ago

@mustafap/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years 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 @mustafapaigeer/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEquals(arr1, arr2): receive two arrays as an input and check if both are equal
  • assertEqual(value1, value2): receives two inputs and check if the inputs are equal
  • asserObjectEquals(obj1, obj2): receives two objects as an input and check if both has the same values and keys
  • countLetter(string): receives a string and counts, how many times each single character is appeared in the given string
  • countOnly(allInputs, objItemsToCount): receive two parameters, first all items to count and second parameter an object with value true or false that will tell our function whether to count or not.
  • head(array): will return the first element in an array.
  • middle(array): This function will return the middle element of a given array.
  • tail(array): This function will return all array elements except for the first element.
  • letterPosition(string): This function will return us all the indexes of each single character in our string into arrays.
  • without(sourceArrary, itemToRemove): This fucntion will remove a given item from an array.