1.0.0 • Published 3 years ago
@rjt-sharma/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 @rjt-sharma/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(arr1, arr2): checks if the provided arrays are equalassertEqual(actual, expected): checks if the provided actual and expected value are equal or notassertObjectEqual(object1, object2): checks if the provided objects are equal or notcountLetters(string): returns the numbers of characters for a provided string (excluding spaces)countOnly(allItems, itemToCount): counts only the items mentioned in allItems which are mentioned in itemsToCounteqArrays(arr1, arr2): checks the equality of two arrayseqObjects(object1, object2): checks the equality of two objectsfindKey(object1, object2): finds key in object1 based on condition provided in object2findKeyByValue(object, value): finds key in object based on value providedhead(array): returns the head of an arrayindex(): contains all the functions of this libraryletterPositions(string): returns an object with index positions of all charcters in the provided stringmap(array,callback): returns an array after performing a speicfied operation on every element of arraymiddle(array): returns middle element of an array (if odd than single element if even than 2 middle values)tail(array): returns the tail of the provided arraytakeUntil(array, callback): returns the portion of provided array until the callback is truewithout(source, itemsToRemove): returns an array with items which are present in source but not in itemsToRemove
1.0.0
3 years ago