1.0.0 • Published 11 months ago
@alinx/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 @alinx/lotide
Require it:
const _ = require('@alinx/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr)
: retrieves the first element from the arraytail(arr)
: retrieves every element except the head of the arraymiddle(arr)
: returns the middle-most element(s) of the arraycountLetters(sentence)
: returns a count of each of the letters in the sentencecountOnly(allItems, itemsToCount)
: returns counts for a specific subset of the itemseqArray(arr1, arr2)
: compares two arrays for a perfect matchfindKey(obj, callback)
: scans the object and return the first keyfindKeyByValue(obj, value)
: finds a key on an object where its value matches a given valueletterPositions(sentence)
: returns all the indices in the sentence where each character is foundmap(array, callback)
: returns a new array based on the results of the callback functiontakeUntil(array, callback)
: returns a slice of the array with elements taken from the beginningwithout(source, itemsToRemove)
: returns a subset of a given array, removing unwanted elements
1.0.0
11 months ago