1.0.1 • Published 2 years ago
@woobrendan/lotide v1.0.1
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 @woobrendan/lotide
Require it:
const _ = require('@woobrendan/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head()
: returns first index of a given arraytail()
: returns the tail of a given arraymiddle()
: returns the middle number(s) of a given arraycountLetters()
: takes a string and returns an object counting the amount of occurences per lettercountOnly()
: takes an array and counts how many occurences of given values to counteqObjects()
: compares two objects to deteremine if they are the samefindKey()
: takes an object and a function as parameters, if value based on conditions from the callback function are met, return the matching keyfindKeyByValue()
: takes an object and a value, returning the key that matches the given valueflatten()
: takes an array with nested arrays and returns a "clean" array of numbersletterPositions()
: takes a string returns and object containing the indexes of each letter in the stringmap()
: takes an array and performs a given callback function on the given arraytakeUntil()
: takes an array and a callback function then grabs all numbers until the call back stop conditionwithout()
: takes a given array and items to remove from that array, then filters items to be removed