1.0.0 • Published 3 years ago
@alisonhussey/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 @alisonhussey/lotide
Require it:
const _ = require('@alisonhussey/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: function to retrieve the first element from the arraytail
: function to return every element except the head of the array.middle
: function to return an array with only the middle element(s) of the provided arrayassertArraysEqual
: function for asserting that two arrays are equalassertEqual
: function for asserting that two outputs are equaleqArrays
: function to compare two arrays for a perfect matchassertObjectsEqual
: function for asserting that two objects are equalcountOnly
: function takes in a collection of items and returns counts for a specific subset of those itemscountLetters
: function takes in a sentence (as a string) and returns a count of each of the letters in that sentenceeqObjects
: function to compare two objects for a perfect matchfindKey
: function to scan an object and return the first key for which the callback returns a truthy value.findKeyByValue
: function searches for a key on an object where its value matches a given valueletterPositions
: function returns all the indices in the string where each character is foundmap
: iterates its elements in insertion order and returns an array of key, value for each iteration.only
: function iterates through an object and returns only those items that match what we're looking for.takeUntil
: function returns a slice of an array with elements taken from the beginning, until the callback returns a truthy valuewithout
: function to filter our data by removing some unwanted items
1.0.0
3 years ago