1.0.0 • Published 2 years ago
@nikaptushkina/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 @nikaptushkina/lotide
Require it:
const _ = require('@nikaptushkina/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: prints success/failure message after comparing actual and expected, but is meant for an arrayassertEqual(actual, expected)
: prints success/failure message after comparing actual and expectedassertObjectsEqual(actual, expected)
: takes in two objects and console.logs an appropriate message to the consolecountLetters(str)
: takes in a sentence (as a string) and then returns a count of each of the letters in that sentencecountOnly(allItems, itemsToCount)
: takes in a collection of items and returns counts for a specific subset of those itemseqArrays(array1, array2)
: compares arrayseqObjects(object1, object2)
: takes in two objects and returns true or false, based on a perfect matchfindKey(obj, callback)
: takes in an object and a callback and returns the first key for which the callback returns a truthy valuefindKeyByValue(obj, objValue)
: takes in an object and a value, and returns the first object key which contains the given valueflatten(array)
: flattens array into single-levelhead(array)
: retrieves first element from arrayletterPositions(sentence)
: returns all the indices in the string where each character is foundmap(array, callback)
: returns a new array based on the results of the callback functionmiddle(array)
: returns the middle-most element(s) of the given arraytail(array)
: retrieves every element except the headtakeUntil(array, callback)
: returns a slice of the array with elements taken from the beginningwithout(source, itemsToRemove)
: removes unwanted items from array
1.0.0
2 years ago