1.0.1 • Published 2 years ago
@philyoo92/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 @philyoo92/lotide
Require it:
const _ = require('@philyoo92/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: array assertion console logs result of whether two arrays are equal or notassertEqual
: assertion of two primitive values and logs result of if match or notassertObjectsEqual
: assertion of two objects and logs result of if match or notcountLetters
: Takes in a sentence then returns a count of each letters as an objectcountOnly
: Takes in a sentence, returns a count of specified word as an objecteqArrays
: function that will take two arrays, and check if they matcheqObjects
: function that will take two objects, compare and return true if matching, false if notfindKey
: Takes in object and callback fn, returns the key from the callbackfindKeyByValue
: takes in object and specified value, use value to check object to find the keyflatten
: will recursively loop through the array until one level of array is reachedhead
: takes in an array and returns the first (0th index) elementletterPositions
: takes in a string, returns an object with all the positions of each lettersmap
: takes in an array, uses callback to modify the array elemnts and return a new arraymiddle
: takes in an array and returns the middle value/s depending on the length of the arraytail
: takes in an array and returns a copy of the original array without the head (0th index item)takeUntil
: takes an array, returns an array from the start to until the callback's first requirements are metwithout
: take in an array + target, removes the target from the array and returns the remaining elements of the array.