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 @nexxai/lotide
Require it:
const _ = require('@nexxai/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
countLetters(str)
: Count how many letters are instr
countOnly(array, object)
: Count how many items defined inobject
(usingkey
:boolean
syntax) exist in the passed in arrayfindKey(obj, callback)
: Return the first key inobject
that matches the passed in callback functionfindKeyByValue(obj, value)
: Return the first key inobject
that has the valuevalue
flatten(arr)
: Flatten a given deeply-nested arrayhead(arr)
: Return the first item in an arrayletterPositions(str)
: Return an array of 0-indexed positions for each letter instring
map(arr, callback)
: Perform the provided callback function over each item inarr
middle(arr)
: Return the middle value(s) inarr
or an empty array if there isn't at least 3 items in ittail(arr)
: Take an array and remove the head (first item) from ittakeUntil(arr, callback)
: Create and return a new array from a given array, with items until the given callback passes a truth testwithout(arr, items)
: Create and return a new array from a given array, removing the given items