1.0.0 • Published 1 year ago
@lukechamberland/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 @lukechamberland/lotide
Require it:
const _ = require('@lukechamberland/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual()
: Asserts if two arrays are equalassertEqual()
: Asserts if two (primitive) values are equalassertObjectEqual()
: Asserts if two objects are equalcountLetters()
: Returns the number of occurances for a character in a given string as a property valuecountOnly()
: Returns the count of a specified array and an objecteqArrays()
: Checks if the two given arrays are equaleqObjects()
: Checks if two objects are equalfindKey()
: Returns first key of an object that returns a truthy value, using a callback. Returns undefined if no value is givenfindKeyByValue()
: Returns the first key that equals a given value, if no key can be found, undefined is returnedflatten()
: Returns a single array when given a nested arrayhead()
: Returns the first element in a given arrayletterPositions()
: Returns an object of each character of a object as a key and the value is the index of where in the string the element was locatedmap()
: Returns a new array using a callbackmiddle()
: Returns the middle element of an array, one element for an odd number of array elements and two if the array contains an even number of elementstail()
: Returns everything in given array except the first elementtakeUntil()
: Returns an array without the beggining until the callback returns a truthy valuewithout()
: Takes in two arrays and removes the contents of the second array from the first array, and then returns the first array
1.0.0
1 year ago