1.0.1 • Published 3 years ago
@archaemedes/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 @archaemedes/lotide
Require it:
const _ = require('@archaemedes/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual()
: Checks if two arrays elements are the same, and makes an assertionassertEqual()
: Checks if two primitives values are the sameassertObjectsEqual()
: Checks if two objects elements are the same, and makes an assertioncountLetters()
: Takes in a sentence (as a string) and then returns a count of each of the letters in that sentencecountOnly()
: Is given an array and an object, It will return an object containing counts of everything that the input object listedeqArrays()
: hecks if two arrays elements are the sameeqObjects()
: Checks if two objects elements are the samefindKey()
: Takes in an object and a callback, It should scan the object and return the first key for which the callback returns a truthy valuefindKeyByValue()
: Takes in an object and a value, It should scan the object and return the first key which contains the given valueflatten()
: Recursively logs elements in a nested array structurehead()
: Return the first element in an arrayletterPositions()
: Returns all the indices (zero-based positions) in the string where each character is foundmap()
: Iterates over an array performing a callback function on each iterationmiddle()
: Return the middle element(s) of an arraytail()
: Return all elements of an array except for the first elementtakeUntil()
: Keeps collecting items from a provided array until the callback provided returns a truthy valuewithout()
: Returns a subset of a given array, removing unwanted elements