1.0.3 • Published 1 year ago
@laurenkaitlyn/lotide v1.0.3
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 @laurenkaitlyn/lotide
Require it:
const _ = require('@laurenkaitlyn/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: accepts an array and returns the first element in an arraytail(...)
: accepts an array and returns the last element in an arraymiddle(...)
: accepts an array returns the middle element (single element array for odd #) (2 elements if even #). return empty array if length is 3 >countLetters(...)
: accpets a string and returns an object with key values pairs to show the count of each letter in the string.countOnly(...)
: accepts an array of strings and returns an object that counts everything that was inputeqArrays(...)
: accepts 2 arrays and returns true or false if they equal eachothereqObjects(...)
: accepts 2 objects and returns true or false if they equal eachotherfindKey(...)
: accepts an object and a callback function and returns the first key in that objectflatten(...)
: accepts an array where some elements can also be arrays and returns one flattened arrayletterPositions(...)
: accepts a string and returns an object with all the characters of the string and where they were found in the stringmap(...)
: accepts an array and a callback function returns the results of calling the function on each element in the arraytakeUntil(...)
: accepts an array and a callback function and returns an array with all the elements from the original array until the callback is truewithout(...)
: accepts an source array and an array of elements to remove returns an array without the elements in the second array