1.0.2 • Published 5 years ago
@scottgrun/lotide v1.0.2
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 @scottgrun/lotide
Require it:
const _ = require('@scottgrun/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
tail(...): returns the array given minus the first elementmiddle(...): returns the middle of an arraymap(...): takes an array and applies a callback to each element in the array and returns a new array with the resultsassertArraysEqual(...): logs weather a given array matches the expected arrayassertEqual(...): logs wether the given value matches the passed expected valueassertObjects(...): logs weather the given object matches the expected objectcountLetters(...): when passed a string returns a object counting the occurences of each letter in the stringcountOnly(...): counts number of occurences of specified elementseqArrays(...): checks if two arrays are equal and returns true or falseeqObjects(...): checks if two given objects are equal and returns true or falsefindKeyByValue(...): searches an object returns the first key has a value that matches the given valuefindKeys(...): finds a key that matches a given valueflatten(...): flattens a nested array into a 1 dimensional onehead(...): returns the first element in the arrayletterPositions(...): returns a object containing the index of each letter in the stringtakeUntil(...): will push elements into a new array until a given value or element is foundwithout(...): returns a new array missing the passed elements to exclude