1.0.0 • Published 5 years ago
@brynschulha/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 @brynschulha/lotide
Require it:
const _ = require('@brynschulha/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(someArray): returns the first element of an arraytail(someArray): returns everything after the first element in an arraymiddle(array): returns the middle element of an arrayassertArraysEqual(actual, expected): prints an assertion that two arrays are equal or notassertEqual(actual, expected): determines equalityassertObjectsEqual(actual, expected): prints an assertion that two objects are equal or notcountLetters(stringInput): counts the number of letters in a stringcountOnly(allItems, itemsToCount): counts the number of a specified elementeqArrays(array1, array2): determines if two arrays are equaleqObjects(object1, object2): determines if two objects are equalfindKey(object, callback): returns a key that has a value that matches the output of a callbackfindKeyByValue(object, value): returns a key given a valueletterPositions(sentence): prints all the letters of a sentence and which index number(s) they appear atmap(array, callback): loops through elements in an array and performs a callback function on them, then stores them in a new arraytakeUntil(arr, callback): will return elements in an array until a certain element is reached which is determined by a callback functionwithout(source, itemsToRemove): takes an array and removes certain specified elements then returns what is left
1.0.0
5 years ago