1.0.1 • Published 5 years ago
@tammytran/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 @tammytran/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): returns an array with the first element of the arraytail(array): returns an array with all elements except the first one of the arraymiddle(array): returns the middle index of the arraycountLetters(string): returns the number of letters in the stringcountOnly(array, itemToCount): returns how many occurances of itemToCount inside the arrayeqArrays(arr1, arr1): compares two arrays for a perfect matcheqObjects(obj1,obj2): compares two objects for perfect matchfindKey(obj, callback): finds the key based on the callback functionfindKeyByValue(obj, value): search for a key on an object where its value matches a given valueflatten(array): flatten nested arraysletterPositions(string): return all indices in the string where each character is foundmap(array,callback): return an array with the callback function mapped to each elementtakeUntil(array,callback):return the array until the callback function is truewithout(array,item): return the array without the item