1.0.1 • Published 2 years ago
@chibeo/lotide v1.0.1
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 @chibeo/lotide
Require it:
const _ = require('@chibeo/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual: assert function for comparing 2 arraysassertEqual: assert function for comparing 2 primitive variablesassertObjectsEqual: assert function for comparing 2 objectscountLetters: take in a string and return a count for each of the letter appreared in that string, ignoring spacescountOnly: take in a collection of items and return the counts for a specific subset of those itemseqArrays: comparing 2 arrayseqObjects: comparing 2 objectsfindKey: take in an object and a callback function and return the first key for which the callback returns a truthy valuefindKeyByValue: take in an object and a value and return the first key which contain the given valueflatten: take in an array with nested arrays and return a flattened version of that arrayhead: return the first item in an arrayletterPositions: take in an array and return all the indices in the string where each character is foundmap: take in an array and a callback function and return a new array based on the result of the callbackmiddle: return the middle-most item(s) of an arraytail: return everything except for the first item of an arraytakeUntil: take in an array and a callback function and return a slice of the array taken from the begining until the callback function return a truthy valuewithout: return a new array with only elements from source array that are not included in itemsToRemove array