1.0.1 • Published 3 years ago
@julezfitz/lotide v1.0.1
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 @julezfitz/lotide
Require it:
const _ = require('@julezfitz/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function1(head)
: Takes the first item in an arrayfunction2(tail)
: Removes the first item from an array and returns the rest of the arrayfunction3(middle)
: Returns the middle item in an array (or two items for an array with an even number of items)function4(eqArrays)
: Returns true if two arrays are equal in length and valuesfunction5(countLetters)
: Given a letter, it counts the number of that character in a given stringfunction6(assertArraysEqual)
: Returns assertion passed if eqArrays returns true, and assertion failed if they are notfunction7(assertEqual)
: Compares an actual and expected result and returns assertion passed if they are equal and failed otherwisefunction8(assertObjectsEqual)
: Compares two objects using eqObjects and if they are equal returns assertion passed, otherwise assertion failedfunction9(countOnly)
: When given an input, it counts the number of instances of that input in an arrayfunction10(eqObjects)
: Compares two objects and returns true if they are the same and false otherwisefunction11(findKey)
: When given a value and an object it returns the first truthy keyfunction12(findKeyByValue)
: When given a specific value, returns that keyfunction13(flatten)
: Removes sub-arrays from an array and lists all the values in their original order in a new arrayfunction14(letterPositions)
: Return the index number of a given character in a given stringfunction15(map)
: Given an array and a callback function, map returns a new array based on the callback resultsfunction16(takeUntil)
: Given an array and a callback function, take until returns a new array which includes the results of the starting array up to the point indicated by the callback