1.0.3 • Published 6 years ago
@atlasskyholder/lotide v1.0.3
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 @atlasskyholder/lotide
Require it:
const _ = require('@atlasskyholder/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: takes in an array and returns the first elementtail
: takes in an array and returns the array without the first element. If the array only had one element then it returns an empty array. If it's empty, it returns an empty arraymiddle
: takes in array and returns middle part.countLetters
: takes a string and returns an object with each letter and how many times it appearscountOnly
: takes in an array of names and an object with names to compare too, and returns an object with the names that appeared and how many times it appeared.findKey
: takes in a nested object and a value for the key of that nested object and returns the key that matches that nested objectfindKeyByValue
: takes in an object and a value and returns the key that matches that valueflatten
: takes in a nested array and flattens itletterPositions
: takes is a string and returns an object with each letter and its position, if it appears in multiple places then the letter will have an arraymap
: takes in an array and a function on how to manipulate that array and adds that array according to that functiontakeUntil
: takes in an array and a function, that function will tell takeUntil to create a new array with only the desired elementswithout
: takes in an array and a list of desired elements to be removed, returns a new array with the elements that weren't removed.eqArrays
: takes in two arrays, compares them and returns true is they are equaleqObjects
: takes in two objects, compares them, and then returns a true or false, plus the objects