1.0.0 • Published 3 years ago
@c1ar3nc3/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 @c1ar3nc3/lotide
Require it:
const _ = require('@c1ar3nc3/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(...)
: assertion check for eqArraysassertObjectsEqual(...)
: assertion check for eqObjectsassertEqual(...)
: uses strict comparison on two valuescountLetters(...)
: take in a string and then return a count of each of the letters in that stringcountOnly(...)
: takes in a collection of items and return counts for a specific subset of those itemseqArrays(...)
: calls eqArrays and returns a message to console if arrays are the sameeqObjects(...)
: function that can compare two arrays for a perfect match.findKey(...)
: checks if key exists in objectfindKeyByValue(...)
: which takes in an object and a value. It will scan the object and return the first key which contains the given value. If no key with that given value is found, then it willreturn undefined.head(...)
: returns the first element of an arrayletterPositions(...)
: return all the indices (zero-based positions) in the string where each character is found.map(...)
: The map function will return a new array based on the results of the callback function.middle(...)
: Returns the middle value of an array. If array is even, returns the middle two.tail(...)
: Returns an array with the first element removedtakeUntil(...)
: The function will return a "slice of the array with elements taken from the beginning." It will keep going until the callback/predicate returns a truthy value.without(...)
: Removes unwanted items from an array
1.0.0
3 years ago