1.0.0 • Published 5 years ago
@rafaysiddiqui_/lotide v1.0.0
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 @rafaysiddiqui_/lotide
Require it:
const _ = require('@rafaysiddiqui_/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): returns first element of an arraytail(array): returns all but the first element of an arraymiddle(array): returns the middle element(s) of an arraycountLetters(string): returns the letter count of each character in a stringcountOnly(itemsArray, itemsToCountObject): Counts the number of occurrences of elements specified in an objectfindKey(object, callback): Returns an object's key that has a value specified by callback functionfindKeyByValue(object, value): Returns an object's key that has the specified valueletterPositions(sentence): Returns an object with the index of all occurrences of every letter in a given sentencemap(array, callback): Returns a modified copy of a specified array based on callback function specificationstakeUntil(array, callback): Returns an array up to an element that matches the conditions specified in callbackwithout(array1, array2): returns array1 excluding any element specified in array2assertArraysEqual(actual, expected): Asserts whether the actual array matches the expected arrayassertEqual(actual, expected): Asserts whether two basic data types are equalassertObjectsEqual(actual, expected): Asserts whether the actual object literal matches the expected object literaleqArrays(array1, array2): Calculates whether the value of two arrays is equaleqObjects(object1, object2): Calculates whether the value of two objects is equal
1.0.0
5 years ago