1.0.0 • Published 4 years ago
@john-mbdp/lotide v1.0.0
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 @John-MBDP/lotide
Require it:
const _ = require('@John-MBDP/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArrayEqual: Custom function to test if both arrays are equalassertEqual: Custom function to help test codes within the filescountLetters: Accepts a string and returns an object with key value pairs, showing the number of times it occured in the stringcountOnly: Accepts an array of string and returns a specific counteqArrays: Accepts two arrays and returns true or false based on if both arrays are equal to each othereqObjects: Accepts two objects and returns true or false based on if both objects are equal to each otherfindKeyByValue: Has two parameters which accepts an object and a value. Goes throught he object and returns the key which contains the provided valuefindKey: Accepts two parameters (object, callback) accepts an object, and callback returns the key that has a truthy valueflatten: One parameter that accepts an array. Checks if there are nested arrays, and if there is, it returns a flattened version of that arrayhead: returns the first element of an arrayletterPositions: Accepts one parameter (string). Returns an object with all of the indexes where each character was foundmap: One parameter that accepts an array and a function. Create a new array based on calling the function on each element in the arraymiddle: One parameter that accepts an array and returns the middle elementstail: One parameter that accepts an array and returns the original array, but without the first elementtakeUntil: Two parameters (array, callback). returns an array with all the items from the original array until the callback function returns a truthy valuewithout: One parameter that accepts an array of items to remove. Returns an array with removed elements
1.0.0
4 years ago