1.0.0 • Published 2 years ago
@sara_v/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 @sara_v/lotide
Require it:
const _ = require('@sara_v/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: takes the head' of the array, returns the value at index 0tail
: takes the 'tail' of the array, returns array with all values minus the value at index 0middle
: return the middle value(s) of an arrayassertEqual
: asserts if two values are equalassertArraysEqual
: asserts if two arrays are equal, prints resultsassertObjectsEqual
: asserts if two objects are equal, prints resultseqArrays
: base code to test if two arrays are equaleqObjects
: base code to test if two objects are equalflatten
: 'flattens out' an array with nested arrays (up to one level)countOnly
: creates an object with keys containing the number of times specific data shows upfindKey
: accepts a callback function and an object. When the callback function returns true with a specific key in that object, that key is returnedfindKeyByValues
: accepts an object and a value. The first key in the object to hold that value is returned.letterPositions
: Returns the index position of specified letters in a stringmap
: test custom version of .maptakeUntil
: accepts a callback and an array. Pushes elements to a new array until it hits an element which returns true with the callbackwithout
: accepts an array, and an element to be removed from that array. Returns an array without those elements.
1.0.0
2 years ago