1.0.0 • Published 2 years ago
@smjeffery22/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 smjeffery22/lotide
Require it:
const _ = require('smjeffery22/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(inputString))
: Take in a string, count how many of each character in the string there are.countOnly(allItems, itemsToCount)
: Take an array of strings and an object specifying what to count within the array.eqArrays(arrayOne, arrayTwo)
: Compare each element of the two arrays in order and return true if the two arrays are the same.eqObjects(object1, object2)
: Return true if two objects have identical keys with identical values.findKey(object, callback)
: Take in an object and a callback; scan the object and return the first key for which the callback returns a truthy value.findKeyByValue(list, find)
: Take in an object and a value; scan the object and returnt he first key which contains the given value. If not found, return undefined.head(data)
: Take in an array and return the first element of the array.letterPositions(sentence)
: Take a string (sentence) and return all the indices in the string where each character is found.map(array, callback)
: Take in an array and a callback; return a new array based on the results of the callback function.middle(array)
: Take in an array and return an array with only the middle element(s).tail(data)
: Take in an array and return an array without the first element of the array.takeUnit(array, callback)
: Take in an array and a callback; return a "slice of the array with elements taken from the beginning" until the callback returns a truthy value. Callback should only be provided one value.without(source, itemsToRemove)
: Take in a source array and an array that contains items to remove from the source array; return a new array without the items that were removed.
1.0.0
2 years ago