1.0.0 • Published 1 year ago
@hoomili/lotide v1.0.0
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 @hoomili/lotide
Require it:
const _ = require('@hoomili/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: receives an array and returns the first element of an arraytail
: receives an array and returns the same array without the initial elementmiddle
: receives an array and return the middle element (one element if the length of the array is an odd number, and array of the middle two element if the length of the array is even)assertArraysEqual
: checks if two arrays are equalassertEqual
: checks if two primitive variables are equaleqArrays
: compares two arrayseqObjects
: compares two objectsassertObjectsEqual
: checks if two objects are equalfindKey
: finds a specific key of an objectcountLetters
: counts the occurrence of each letter inside a sentenceflatten
: flattens a nested arraycountOnly
: counts specific items in an array based on a key values of an objectmap
: transforms the array elements based on the function provided by the userfindKeyByValue
: finds the first key that represents the value given by the userletterPositions
: returns an array of index occurrence of a given letter in a sentencetakeUntil
: receives an array and a string. iterates through the array and returns an array of strings up to the string provided by the user.without
: receives two arrays of numbers and removes the elements from the first array that matches the second array
1.0.0
1 year ago