1.0.0 • Published 4 years ago
@ryanak/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 @ryanallenk/lotide
Require it:
const _ = require('@ryanallenk/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): returns the element of a given arraytail(array): returns a new array with the head (first element) removedmiddle(array): returns an array with the middle element(s)countLetters(string): returns and object that counts the number of times each character occurs in a stringcountOnly(allItems, itemsToCount): returns an object that counts the number of times a specific item occurs in the input arrayfindKey(object, callback): returns the key of an object based on the callback functionfindKeyByValue(object, value): return the key value of an object based on the input keyletterPositions(sentence): returns an object with each letter and its index position as key value pairsmap(array, callback): returns a new array based on the input array and the callback function modificationtakeUntil(array, callback): returns a new array with each element of the given array until the callback function returns truewithout(source, itemsToRemove): returns a new array with the given item removed
1.0.0
4 years ago