1.0.2 • Published 2 years ago
@matt.james.morgan97/lotide v1.0.2
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 @matt.james.morgan97/lotide
Require it:
const _ = require('@matt.james.morgan97/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1,arr2): assertion to check for equal arraysassertEqual(expected, actual): assertion for two valuesassertObjectsEqual(obj1,obj2): assertion to check if two objects are equalcountLetters(str): returns object with every letter in the string as keys and the values is how many times that letter occuredcountOnly(arr,obj): this will return an object that contains the counts of items in the first arreqArrays(arr1,arr2): will return true if two arrays are equalfindKey(obj, callback): will return first key that returns true for callback functionfindKeyByValue(obj, value): returns key that has given valueflatten(arr1): takes a nested array and returns a new array that isn't nestedhead(arr1): takes an array and returns the first element of that arrayletterPositions(str): takes a str and returns an object as all the letters as keys and the position of the letters as the valuesmiddle(arr): returns an arr containing middle of given arraytail(arr): returns an arr without first element of given arraytakeUntil(arr, callback): returns an arr of all elements in array until specified value in callbackwithout(arr): returns an arr containing all elements besides the elements specified elements in second arrmap(arr, callback): returns an arr that has had callback implemented on every element