1.0.1 • Published 5 years ago
@mitra_nami/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 @mitra_nami/lotide
Require it:
const _ = require('@mitra_nami/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): returns the first element of the arraytail(array): returns the array without the first elementmiddle(array): returns the middle of the arraymap(array, callback): returns elements of an array based on the callback functionwithout(source, itemsToRemove): returns a subset of a given array,removing unwanted elementstakeUntil(array, callback): returns an array whose elements are from the array until the callback returns a truthy valueeqArrays(array1, array2): returns true if the arrays are equal otherwise falsecountLetters(string): returns an object with letters as keys an their counts as valuesfindKey(obj, callback): returns the first key of the obj for which the callback returns a truthy valueletterPositions(string): returns an obj whose keys are letters and values are arrays of indicieseqObjects(obj1, obj2): returns true if obj1 and obj2 are equal otherwise falseflatten(array): returns the un-nested array