@rghatore/lotide
v1.0.0
Published
A mini clone of the Lodash libary; completed as an academic project at Lighthouse Labs.
Downloads
8
Readme
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 @rghatore/lotide
Require it:
const _ = require('@rghatore/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: returns the first element of an arraytail
: returns all elements of an array excluding the firstmiddle
: returns the middle elements of an array. For odd number of elements, output is [middle]. For even number of elements, output is [middle1, middle2]countLetters
: returns the number of times a particular letter appears in a stringcountOnly
: returns number of times particular items show up in and objectfindKey
: returns the first key which has a truthy value in an objectfindKeyByValue
: returns the first key associated with valueletterPositions
: returns the index values where a particular letter appears in a stringmap
: returns an array after running a function on its elementstakeUntil
: returns an array with elements from an array until it reaches the callback truthy valuewithout
: removes the elements of an array based on another array