1.0.0 • Published 3 years ago
@nevets/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 @nevets/lotide
Require it:
const _ = require('@nevets/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: return the first element of an arraytail(array)
: returns all but the first element of an arraymiddle(array)
: returns the middle element(s) of an arraycountLetters(sentence)
: returns how many times a letter is used in a stringcountOnly(allItems, ItemsToCount)
: returns how many instances of each string were found in the array of stringseqArrays(array1, array2)
: takes in two arrays and returns true or false based on a perfect matchfindKey(object, callback)
: returns the first key for which the callback returns a truthy valueletterPositions(sentence)
: returns all the indices (zero-based positions) in the string 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 beginning. It keeps going until the callback returns a truthy valuewithout(sourceArray, itemsToRemove)
: return a subset of a given array, removing unwanted elements
1.0.0
3 years ago