@ojripley/lotide
v1.0.0
Published
a mini clone of the https://lodash.com library. Developed as a learning exercise only, DO NOT use this library in production code.
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 @ojripley/lotide
Require it:
const _ = require('@ojripley/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)-> returns the first element in an arraytail(array)-> returns the last item of an arraymiddle(array)-> returns the middle item of an array, or an empty array if the length is less than 3assertEqual(actual, expected)-> asserts the equality of two primitive type valuesassertArraysEqual(array1, array2)-> asserts the equality of two arraysassertObjectsEqual(object1, object2)-> assertation for comparing two objectscountLetters(string)-> returns on object with an array for each letter found in the string and its countcountOnly(allItems, itemsToCount)-> returns an object of the items specifed to count by itemsToCount from allItemseqArrays(object1, object2)-> determines object equalityeqObjects(obj1, obj2)-> returns true if two objects are equalfindKey(object, callback)-> finds the first key occurance that matches the condition determined by the callback functionfindKeyByValue(obj, value)-> returns the value of the key specified in an objectflatten(array)-> flattens in arrays into the same level as the outter array. The flattened array gets returned and the originla remains unmodifiedletterPositions(string)-> returns an object of letters with an array assigned to each containing the index positions of each occurance of the lettermap(array, callback)-> returns a new array with the changes implemented on the original as decided by the callback functiontakeUntil(array, callback)-> returns a new array with values taken from the original until the condition determined by the callback function is metwithout(sourceArray, itemsToRemoveArray)-> returns a new array with any matching items between the source array and the remove array removed
