1.0.0 • Published 6 years ago
@cmastel/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 @cmastel/lotide
Require it:
const _ = require('@cmastel/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(stringToCount): counts the number of letters in a string, ignoring spacescountOnly(allItems, itemsToCount): returns an object that contains the number of occurences of values in an arrayfindKey(object, callback): scans an object and returns the first key for which the call back returns a truthy valefindKeyByValue(object, value): loops through an object and returns the first key with the desired valueflatter(array): takes a nested array, and flattens it into a single layer arrayhead(array): returns the first element of an arrayletterPositions(sentence): returns an object that contains the index of each letter in a sentencemap(array, callback): loops through each element of any array, and creates a new array based on the callback funtionmiddle(array): returns the middle element of an array, or an array of the two middle values if the array length is eventail(array): returns an array containing every element other than the first of the provided arraytakeUntil(array, callback): will return a slice of an array with elements from the beginning, until when the element returns a truthy value from the callback functionwithout(source, itemsToRemove): returns an array without the specified items from the provided array
1.0.0
6 years ago