1.0.0 • Published 5 years ago
@thomasbogdanov/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('@thomasbogdanov/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
Implimented with index
tail(array)
: returns the tail of an arrayhead(array)
: returns the head of an arraymiddle(array)
: returns the middle element of an arrayassertArraysEqual(array)
: compares two arraysassertEqual(a, b)
: compares two valuesassertObjectsEqual({a}, {b})
: compares two objectscountLetters(string)
: counts all the letters in a stringcountOnly({a})
: counts specific elements in an objecteqArrays(arr1, arr2)
: compares two arrays and returns true or falseeqObjects({a},{b})
: compares two objects and returns true or falsefindKey(object, callback)
: searches for a specific key in an objectfindKeyByValue(keys, values)
: searches for keys with value inputsflatten(arr)
: takes an array and removes any nested arrays to return a single arrayletterPositions(string)
: finds all the positions of a letter in a sentence/wordmap(array, callback)
: Does a bunch of stuff (google map function)takeUntil(array, callback)
: Reads through an array until a certain value is found / condition is metwithout(array, itemsToRemove)
: Removes items out of an array that you dont want.
1.0.0
5 years ago