1.0.2 • Published 5 years ago
@sandratoh/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 @sandratoh/lotide
Require it:
const _ = require('@sandratoh/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(arr): returns element at index 0 of arraytail(arr): returns new array with everything except index 0 element of original arraymiddle(arr): returns middlemost element(s) in an arrayassertEqual(actual, expected): assert primitive data type comparisonseqArrays(arrOne, arrTwo): returns true if both arrays have identical elements in identical index valuesassertArraysEqual(actual, expected): assert array values usingeqArraysas callbackeqObjects(object1, object2): returns true if both objects have identifical keys with identical valuesassertObjectsEqual(actual, expected): assert object values usingeqObjectsas callbackfindKeyByValue: returns the first key of a given value in an objectletterPositions: returns an object with key-value pairs of each character in a stringcountOnly: returns an object containing counts of everything in the array that the input object listedflatten: returns a new array with flattened elements given an array with onen nested layer