1.0.0 • Published 5 years ago
@justin-moretto/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 @justin-moretto/lotide
Require it:
const _ = require('@justin-moretto/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array): takes an array and returns the 0 indextail(array): takes an array and returns it minus the 0 indexmiddle(array): returns one middle element of an array (or two elements, if array.length is even)assertArraysEqual(actual, expected): compares two arrays and returns a boolassertEqual(actual, expected): compares two primitive data types and returns a boolassertObjectsEqual(actual, expected)): compares two objects and returns a boolcountLetters(string): counts how many times each letter occurs in a string, returns an objectcountOnly(allItems, ItemstoCount): takes an array and an object; takes in a collection of items and return counts for a specific subset of those items; returns an objecteqArrays(array1, array2): takes in two arrays and returns true or false, based on a perfect matcheqObjects(): descriptionfindKey(): descriptionfindKeyByValue(object, value): search for a key on an object with given valueflatten(): Given an array with other arrays inside, flattens it into a single-level array.letterPositions(string): return all indices in a string where each character is found; returns objecttakeUntil(): descriptionwithout(): return a subset of a given array, removing unwanted elements.map(array, callback): return a new array based on the results of the callback function.
1.0.0
5 years ago