README
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 @sjehanneh/lotide
Require it:
const _ = require('@sjehanneh/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual = function(actual, expected)
: Asserts whether two arrays are equalassertEqual = function(actual, expected)
: Asserts whether two values are equalasserObjectsEqual = function(actual, expected)
: Asserts whether two objects are equalcountLetters = function(string)
: Takes in a sentence (string) and returns a count of each of the letters in that sentencecountOnly = function(allItems, itemsToCount)
: Takes in a collection of items and returns the counts for specific itemseqArrays = function(array1, array2)
: Compares two arrays for a perfect matcheqObjects = function(object1, object2)
: Returns true or false, based on if two obejcts are a perfect matchfindKey = function(object, callback)
: Returns the first key in an object for which the callback returns a truthy value. If no key is found, then it returns undefined.findKeyByValue = function(object, value)
: searches for a key on an object where its value matches a given valuehead = function(array)
: Returns the head (very first item) of an arrayletterPositions = function(sentence)
: Returns all the indices (zero-based positions) in the string where each character is foundmap = function(array, callback)
: Returns a new array based on the results of the callback functionmiddle = function(array)
: Returns the middle element(s) of an arraytail = function(array)
: Returns the tail (elements after the head) of an arraytakeUntil = function(array, callback)
: Collects items from a provided array until the callback provided returns a truthy valuewithout = function(source, itemsToRemove)
: Takes in two arrays and returns a new array with only elements from first array that are not present in the second array.