1.0.0 • Published 3 years ago
@hanvid/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 @hanvid/lotide
Require it:
const _ = require('@hanvid/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
eqArrays = function(first,second): checks if 2 arrays are equal prints true/falseassertEqual = function(actual, expected): compares expected vs actual valuesassertArraysEqual = function(actual,expected): compares actual vs expected arraysassertObjectsEqual = function(actual, expected): compares actual vs expected objectscountLetters = function(string): counts the number of lettercountOnly = function(allItems, itemsToCount): returns an object of the count of each key in first parametereqObjects = function(object1, object2): checks if 2 objects are equal prints true/falsefindKey = function(object, callback): checks to see if there is a key in object that matches callbackfindKeyByValue = function(object, value): searches through object and outputs the first key that matches the value parameterhead = function (array): returns the first index of an arrayletterPositions = function(sentence): returns an object showing which index the letters of the string is placed.map = function(array, callback): creates a new array using a callback function that affects each value of the arraymiddle = function(array): returns a new array of the mid point value of the array and if it is an even length then print the middle twotail = function(array): returns all the values in the array except the first indextakeUntil = function(array, callback): copies array until value matches callbackwithout = function(source, itemsToRemove): copies the array as a new array without the values in the itemsToRemove parameter
1.0.0
3 years ago