1.0.0 • Published 3 years ago
@kaylinjdennis/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 @kaylinjdennis/lotide
Require it:
const _ = require('@kaylinjdennis/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(array)
: returns first element of an arraytail(array)
: returns a new array of all but the first element of given arraymiddle(array)
: returns an array of the middle element(s) of a given arrayassertArraysEqual(arr1, arr2)
: asserts that two given arrays are equalassertEqual(actual, expected)
: asserts that two values are equalassertObjectsEqual(actual, expected)
: asserts that two objects are equalcountLetters(str)
: returns an object of the number of times each letter in a string appearscountOnly(allItems, itemsToCount)
: returns an object containing the number of times items specified to be counted appear in the given arrayeqArrays(arr1, arr2)
: checks whether or not two arrays are equaleqObjects(obj1, obj2)
: checks whether or not two objects are equalfindKey(object, callback)
: returns key described by calllback functionfindKeyByValue(object, value)
: returns key with specified valueletterPositions(sentence)
: returns object of what positions each letter in a string was found atmap(array, callback)
: returns an array that has had the callback function called on each elementtakeUntil(array, callback)
: returns an array of all elements in the given array until the callback function returns truewithout(source, itemsToRemove)
: returns an array with specified items removed
1.0.0
3 years ago