@oatmilkies/lotide
v1.0.1
Published
A simple library based off of lodash. Created as a way to learn js. Update: added more detailed comments
Downloads
1
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 @oatmilkies/lotide
Require it:
const _ = require('@oatmilkies/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head([1, 2, 3])
: Returns the fist item in an arraytail([1, 2, 3])
: Returns every element but the first element in an arraymiddle([1, 2, 3, 4])
: Return the middle elements in an arrayassertArraysEqual(["a, "b""], ["a", "b"])
: Displays output for eqArrays()assertEqual("a", "a")
: Checks if 2 parameters are equal or notassertObjectsEqual({a: 1, b: 2}, {a: 1, b: 2})
: Displays output for eqObjects()countLetters("hello there")
: Returns the count of each letter in a given sentencecountOnly([2, 3, 5, 2, 5)
: Returns an object containing counts of everything that the input object listedeqArrays([1, 2], [1, 2])
: Returns if 2 arrays are equal or noteqObjects({a: 1, b: 2}, {a: 1, b: 2})
: Returns if 2 objects are equal or notfindKey({object}, x => x.key === "something")
: Returns the first key for which the callback returns truthyfindKeyByValue({a: 1, b: 2}, 2)
: Search for a given value in the object and return its keyflatten(['a, 2, ['b, 'c], 5])
: Flattens a multidimensional array into single levelletterPositions("hello there")
: Return the position of each letter in a sentencetakeUntil([array], x => x === "something")
: Print out the elements of an array until the callback function requirements are truewithout([1, 2, 3], [1])
: Given and array with elements to remove, creates a new array without those elements