1.0.0 • Published 3 years ago
@sylastheodor/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 @sylastheodor/lotide
Require it:
const _ = require('@sylastheodor/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns the first element (head) of an arraytail(array)
: returns the last element (tail) of an arraymiddle(array)
: returns the middle 1 or 2 elements depending on array lengthcountLetters(text)
: counts the amount of letters in a string of textcountOnly(array, targets)
: counts ONLY the targets within an arrayfindKey(object, callback)
: find the property of an object called in the callbackfindKeyByValue(object, value)
: returns the property of an object that has the matching valueletterPositions(text)
: returns a list of all letters in the text, and their position in the sentencemap(array, function)
: runs a function on each element of an arraytakeUntil(array, callback)
: return the elements of an array until the conditions of the callback function are metwithout(source, itemsToRemove)
: return a new array containing none of the items in the itemsToRemove array
1.0.0
3 years ago