1.0.0 • Published 2 years ago

@marcogamal/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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 @marcogamal/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head: returns the first element of an array
  • tail: returns the array without the first element
  • middle: returns the middle element(s) of the array
  • assertArraysEqual: accepts two arrays and compare them to check if they are equal
  • assertEqual: accepts two values and compare them to check if they are equal
  • assertObjectsEqual: accepts two objects as parameters and return true if they are equal
  • countLetters: accepts a string and return the occurence of the object
  • countOnly: accepts an array and the parameter, then return the objects in the arrays
  • eqArrays: returns true if two arrays are equal
  • eqObjects: returns true if two objects are equal
  • findKey: accepts an object and a callback
  • findKeyByValue: accepts object and argument then return the key value and compare if they are equal
  • flatten: acceptsan array with other arrays inside and return them into a single-level array.
  • letterPositions: returns a string's index position character
  • map: accepts an array and a callback then return it to modified array with applied callback function
  • takeUntil: return a slice of the array with elements taken from the beginning
  • without: returns a subset of a given array, removing unwanted elements