1.0.0 • Published 6 years ago
@ranthonym/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 @ranthonym/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual(): checks for equality assertion of 2 non-object valuesassertArraysEqual(): checks for equality assertion of 2 arraysassertObjectsEqual(): checks for equality assertion of 2 objectshead() : returns the first index element of an arraytail() : returns array without the head elementmiddle(): returns the middle index elements of an arrayeqArrays(): compares 2 arrays and returns a boolean valueeqObjects(): compares 2 objects and returns a boolean valuetakeUntil(): take in source value and array, returns subset array with all values up to first instance of source valuewithout(): take in source values and array, returns subset array without those source valuesmap(): takes in a function argument and returns a mutated arrayletterPositions(): return all the indices (zero-based positions) in the string where each character is found.flatten(): takes in an array of arrays and returns a "flattened" version of the array.findKey(): takes in an object and a callback and returns the first key for which the callback returns a truthy value.findKeyByValue(): takes in an object and a value and returns the first key which contains the given value.countOnly(): takes in a collection of string items and returns counts for a specific subset of those items.countLetters(): takes in a sentence (as a string) and then returns a count of each of the letters in that sentence.
1.0.0
6 years ago