1.0.1 • Published 2 years ago
@nadia_pia/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 @nadia_pia/lotide
Require it:
const _ = require('@nadia_pia/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(string)
: returns a count of each of the letters in the input stringcountOnly(array, object)
: takes in an array and counts number of elements specified as <element: true> in an object providedeqArrays(array1, array2)
: compare two arrays for an exact matcheqObjects(object1, object2)
: compare two objects for an exact matchfindKey(object, callback)
: return the first key in the object for which the callback returns a truthy valuefindKeyByValue(object, value)
: searches for a key on an object where its value matches a given oneflatten(array)
: "unpacks" nested arrays in the input array, making it single-levelhead(array)
: returns the first element of the arrayletterPositions(string)
: returns an object containing the list of letters containing in the input string as properties and arrays of zero-based positions of every letter as corresponding valuesmap(array, callback)
: iterates through the array applying the callback function ob every its elementmiddle(array)
: return an array with only the middle element(s) of the input arraytail(array)
: returns every element except the head (first element) of the arraytakeUntil(array, callback)
: returns a part af the input array from the beginning to the element which causes the callback function to return a truthy valuewithout(array1, array2)
: returns a new array without elements of array1 which match elements of array2