1.0.0 • Published 5 years ago
@derekb123/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 @derekb123/lotide
Require it:
const _ = require('@derekb123/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head: returns the first element in an arraytail: returns everything after the first element of an arraymiddle: returns the middle element of an array if odd, or the two middle elements if equalassertEqual: checks if two values are equalassertArraysEqual: checks if two arrays are equal and returns an empahsized messagecountLetters: takes a string and returns an object with counts for the number of times each character is used in that stringcountOnly: takes one array and another array of chosen values, returns an object that counts only the number of times the chosen values are usedeqArrays: checks if two arrays are euqal and returns true or falseeqObjects: checks if two objects are equalfindKey: returns the first key in an object that matches a value parameterfindKeyByValue: returns the key that matches a provided valueflatten: flattens nested arrays into a single arraymap: transforms all elements in an array by function parameterreverse: reverses an arraytakeUnitl: return elements in an array until a passed paramter is metwithout: return an intial array without the passed items
1.0.0
5 years ago