1.0.1 • Published 3 years ago
@kcruz95/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 @kcruz95/lotide
Require it:
const _ = require('@kcruz95/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head (array)
: returns the 1st element index of an arraytail (array)
: returns the body of an array sans the 1st element indexmiddle (array)
: returns the middle (two) element(s) of an arrayassertArraysEqual (actual, expected)
: uses eqArrays to check if two arrays are equalassertEqual (actual, expected)
: asserts if two values are equalassertObjectsEqual actual, expected)
: asserts if two objects are equalcountLetters (str)
: counts each letter of a stringcountOnly (allItems, itemsToCount)
: counts the keys of an inputted object and returns an object with a matching set of keys and valueseqArrays (arrayOne, arrayTwo)
: compares two arrayseqObjects (objectOne, objectTwo)
: compare two objectsfindKey (object, callback)
: scans the object and returns the 1st key with a truthy callback valuefindKeyByValue (object, value)
: searches for an object key whose value matches a given valueletterPositions (sentence)
: returns all the indices of a string where each charcter is foundmap (array, callback)
: returns a new array with the results of calling a function on every element in the array being calledtakeUntil (array, callback)
: returns all items from an array until the callback returns a truthy valuewithout (source, itemsToRemove)
: returns an arry without items listed by the parameter: itemsToRemove