1.0.2 • Published 2 years ago
@greenlemonkp/lotide v1.0.2
Lotide - Joon Lee
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 @greenlemonkp/lotide
Require it:
const _ = require('@greenlemonkp/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(firstArray, secondArray)
: check if two arrays are equalassertEqual(actual, expected)
: check if two primitive elements are equal or notassertObjectsEqual(actual, expected)
: Returns true if both objects have identical keys with identical values. Otherwise you get back false!countLetters(str)
: Takes in a string and returns a count of each letter in the sentence(string)countOnly(allItems, itemsToCount)
: Takes in a collection of items and return counts for a second parameter of those itemseqArrays(firstArray, secondArray)
: Returns true if two arrays compared are equaleqObjects(object1, object2)
: Returns true if two objects compared are equalfindKey(names, callback)
: Takes object being calledback and returns first keyfindKeyByValue(object, value)
: Returns a key on an object where its value matches a given value.flatten(arr)
: It flattens arrays inside array it into a single-level array.head(arr)
: Returns first element in an arrayletterPositions(sentence)
: Takes an argument and returns object showing position of each lettermap(array, callback)
: Returns a new array based on the results of the callback functionmiddle(array)
: Takes in an array and return the middle element(s) of the given array