@biancafu/lotide
v1.0.2
Published
lotide project created by @biancafu during LightHouse Lab bootcamp
Downloads
4
Readme
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 @username/lotide
Require it:
const _ = require('@biancafu/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(actual, expected)
: comparing the actual and expected values, print out message to show if they are same or notassertArraysEqal(arr1, arr2)
: comparing arr1 and arr2, print out message to show if they are same or notassertObjectsEqual(object1, object2)
: comparing object1 and object2, print out message to show if they are same or noteqArrays(actual, expected)
: returns true if arr1 has same elements as arr2, otherwise, return falseeqObjects(actual, expected)
: returns true if object1 has same properties as object2, otherwise, return falsecountLetters(string)
: return an object with the occurance of each lettercountOnly(allItems, itemsToCount)
: returns an object that count the items from allItems if it exists in itemsToCount with a true valuefindKey(object, callback)
: return the key that has a value satisfying the call back functionfindKeyByValue(object, value)
: return the key by valuehead(array)
: returns the head of arraymiddle(array)
: returns middle of arraytail(array)
: returns tail ofr arrayflatten(array)
: returns the flattened the arraymap(array, callback)
: returns an array that satisfies the callback functionletterPositions(string)
: returns an array of the position(s) of input letter(s)takeUntil(array, callback)
: returns an array that contains all elements before the callback function is satisfiedwithout(source, itemToRemove)
: returns an array of source without the elements itemToRemove