A mini clone of the Lodash library.
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.
Install it:
npm install kinetics11/lotide
Require it:
const _ = require('kinetics11/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
The following functions are currently implemented:
assertArraysEqual(arr1, arr2)
: Compares the equality of two arraysassertEqual(actual, expected)
: Compares two values, and the expected result of a functionassertObjectsEqual(actual, expected)
: Compares two objects for equality, and the expected resultcountLetters(string)
: Returns the number of letters in a stringcountOnly(allItems, itemsToCount)
: Takes in a collection of items and return counts for a specific subset of those itemseqArrays(arr1, arr2)
: Loops through two arrays to check for equalityeqObjects(object1. object2)
: Takes in two objects and returns true or false, based on a perfect matchfindKey(obj, callback)
: Scans the object and returns the first key in which the callback returns a truthy value. Will return undefined if no key is foundfindKeyByValue(object, value)
: Scans the object and returns the first key that contains the given value. Will return undefined if no key with the given value is foundhead(array)
: Returns the first item in the arrayletterPositions(sentence)
: Takes a sentence and returns the index of each letter within the sentencemap(array, callback)
: Creates a new array that has the results of calling a function on each element of the input array (an alternative to the Array,prototype.map() method)middle(arr1)
: Returns the middle index element(s) of an arraytail(array)
: Returns all items except for the first item of the arraytakeUntil(array, callback)
: Returns elements from an array until the callback provided returns a truthy valuewithout(arr1, exclude)
: Returns a new array excluding the specified unwanted elements