@vhkan/lotide
v1.0.1
Published
The project was made as part of the code learning course
Downloads
4
Readme
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 @vhkan/lotide
Require it:
const _ = require('@vhkan/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
function(head)
: the function returns 1st array elementsfunction(middle)
: the function returns 2 middle array elementsfunction(tail)
: the function returns the last array elementfunction(map)
: the function returns a new array after taking every array valuefunction(assertArraysEqual)
: the function asserts 2 arrays valuesfunction(assertEqual)
: the function asserts 2 arrays valuesfunction(eqArrays)
: the function checks the equality of 2 arraysfunction(takeUntil)
: the function returns the array of elements until the point mentioned in the function conditionsfunction(without)
: the function returns a new array of elements from the 1st array not found in the 2nd arrayfunction(countLetters)
: the function takes in a sentence and returns a count of each of the letter in that sentencefunction(countOnly)
: the function takes allItems: an array of strings that we need to look through, and itemsToCount: an object specifying what to countfunction(eqObjects)
: the function compares 2 objects and returns "true" if they're equal, and "false" if notfunction(findKey)
: the function takes 2 parameters: obj,callback. The obj where it looks for a specific key, and callback that defines the condition to look for a keyfunction(findKeyByValue)
: the function returns a key with a specific value (key by value)function(letterPositions)
: the function takes a string as a parameter and returns the object with character positionsfunction(assertObjectsEqual)
: the function compares 2 objects and asserts if they are equalfunction(flatten)
: the function returns a flattened version of the array