1.0.0 • Published 4 years ago
@katebatrakova/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 @katebatrakova/lotide
Require it:
const _ = require('@katebatrakova/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function1(head)
: returns the first element of the arrayfunction2(tail)
: returns the last element of the arrayfunction3(middle)
: returns the middle-most element(s) of the given arrayfunction4(without)
: returns a subset of a given array, removing unwanted elementsfunction5(takeUntil)
: returns a slice of array with elements taken from the beginning. It will keep collecting items from a provided array until the callback (predicate) provided returns a truthy value. The predicate is invoked with three arguments: (value, index, array)function6(map)
: returns a new array based on the results of the callback function, which will be called for each element in the arrayfunction7(letterPositions)
: returns all the indices (zero-based positions) in the string where each character is foundfunction8(findKeyByValue)
: takes in an object and a value. It scans the object and returns the first key which contains the given value. It returns undefined if no key with the given value is found.function9(findKey)
: scans the object and returns the first key for which the callback returns a truthy value. If no key is found, then it should return undefinedfunction10(eqObjects)
: takes in two objects and returns true or false, based on a perfect matchfunction11(eqArrays)
: takes in two arrays and returns true or false, based on a perfect matchfunction12(countOnly)
:takes in a collection of items and return counts for a specific subset of those items. In order to decide what to count, items we care about are 'truthy' and it will only count those, ignoring the othersfunction13(countLetters)
: takes in a sentence (as a string) and returns a count of each of the letters in that sentence
1.0.0
4 years ago