1.0.0 • Published 5 years ago
@hbregman/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 @hbregman/lotide
Require it:
const _ = require('@hbregman/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(string): returns an object that shows number of instances each letter appears in the stringcountOnly(mainString, {string1: true, string2: false, etc..}): returns an object with number of of instances strings that have the values 'true' appear in a mainStringfindKey(obj, callback): returns a key that has a certain value through a callback which specifies the condition of the valuefindKeyByValue(obj, value): returns a key that has a certain valueflatten([nested, [array]]): return array without the nested arrayshead([array, array etc...]): returns the first element in the arrayletterPositions(string): returns an object with keys pertaining to all the letters in the string with values pertaining to the positions (or indecies) of those letters in the stringmap(input, callback): modifies input according to the condition in the callbackmiddle(array): returns the middle value(s) of an arraytail(array): returns the array after removing the first itemtakeUntil(array, callback): returns the items in the array until a condition in the callback is satisfiedwithout([array], [number/array]): returns the array adter removing the number/array specified
1.0.0
5 years ago