1.0.0 • Published 3 years ago
@idiljei/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 @username/lotide
Require it:
const _ = require('@idiljei/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: Given an array, it returns the first elementmiddle((array)
: returns middle element of array - If array is even, returns both middle ones, if odd returns the middle onetail(array)
: Returns the last element of an arraytakeUntil(array)
: given an array and callback function, returns all elements up to a matchwithout(array, array)
: returns new array when given an exclusion list that doesnt have excluded elementscountLetters(string)
: when given a string, returns object with the number of occurence for eachcountOnly(allItems, itemsToCount)
: Given an object and list of values, it returns number of occurences for eacheqArrays(array1, array2)
: Checks if both arrays are the sameeqObjects(object1, object2)
: Checks if both objects are the sameletterPositions(string)
: Given a string, returns object with an array of positions for eachfindKey(object, callback)
: Given a object and callback, it returns the key associated with itfindKeyByValue(obj,val)
: Given a object and callback, it returns the key associated with itmap(array, callback)
: Given an array and callback function, returns an array with callback applied
1.0.0
3 years ago