1.0.1 • Published 5 years ago
@chonie1/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 @chonie1/lotide
Require it:
const _ = require('@chonie1/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(str): counts the number of occurences of each character given a stringcountOnly(allitems, itemsToCount): given an allItems array, and an itemsToCount object, returns an object with the value true/false if the item in itemsToCount is present in allItemseqArrays(arr1, arr2): returns true if two arrays are equal else falseeqObjects(obj1, obj2): returns true if two objects are equal else falsefindKey(obj, callback): returns a key in the obj given a callback function with a conditionalfindKeyByValue(obj, val): returns the first key in the obj that matches the val inputflatten(arr): flattens a nested arrayhead(arr): returns the first element of the arrayletterPositions(str): returns an array of indices for each char in the stringmap(arr, callback): changes the array given a callback functionmiddle(arr): returns the middle element of the array (returns an array of two numbers if the input array length is even)tail(arr): removes the first element of the arraytailUntil(arr, callback): returns part of the array depending on the callback conditionalwithout(source, itemsToRemove): removes items in source given an itemsToRemove array