1.0.0 • Published 3 years ago
@jenlaw266/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 @username/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
_.head(array)
: returns the first item of an array_.tail(array)
: returns a shallow cope of an array without the first item_.middle(array)
: return the middle item(s) of an array_.assertArraysEqual(array1, array2)
: check if one array is equal to another_.assertEqual(primitive1, primitive2)
: check if one item is equal to another_.assertObjectsEqual(object1, object2)
: check if one object is equal to another_.countLetters(string)
: count the letters in a string (no spaces)_.countOnly(arrayOfItems, itemToCount)
: count items & recurring items in an array (returns an object)_.eqArrays(array1, array2)
: check if one array is equal to another (result get passed to assertArraysEqual)_.eqObjects(object1, object2)
: check if one object is equal to another (result get passed to asssertObjectsEqual)_.findKey(object, callback)
: find the first key of an object with the object and a callback function as arguments_.findKeyByValue(object, value)
: find the first key of an object with the object and value as argements_.flatten(array)
: flatten the array by one layer_.letterPosition(string).letter
: find the letter position in the given string (returns an array of index numbers)_.map(array, function)
: returns a new array with changes made by the callback function_.takeUntil(array, function)
: returns a new array with the original array values until the function's stopping condition_.without(array, itemToRemove)
: remove the specified item in the array
1.0.0
3 years ago