1.0.0 • Published 4 years ago
@davichavix/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 @davichavix/lotide
Require it:
const _ = require('@davichavix/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: Function asserts if two arrays are equal and logs resultassertEqual
: Function asserts if two values are equal and logs resultassertObjectEqual
: Function asserts if two objects are equal and logs resultcountLetters
: Function returns a count of each letters in a stringcountOnly
: Function return an object containing counts of everything that the input object listedeqArrays
: Function compares if two values are equaleqObjects
: Function compares if two objects are equalfindKey
: Function returns the first key for which the callback returns a truthy valuefindKeybyValue
: Function returns key based on matching valueflatten
: Function returns an array containing elements including nested arrays of elements, and return a "flattened" version of the array.head
: Function returns the first element from the arrayletterPositions
: Function return all the indices (zero-based positions) in the string where each character is foundmap
: Function returns a new array based on the results of the callback functionmiddle
: Function returns an array with only the middle elementtail
: Function returns the tail elements from the arraytakeUntil
: function will return a slice of the array with elements taken from the beginning until callback criteria metwithout
: Function takes in a source array and a itemsToRemove array. It should return a new array with only those elements from source that are not present in the itemsToRemove array.
1.0.0
4 years ago