1.0.1 • Published 2 years ago
@kbmaglalang/lotide v1.0.1
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 @kbmaglalang/lotide
Require it:
const _ = require('@kbmaglalang/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual(actual, expected)
: assert if two arrays are equalassertEqual(actual, expected)
: assert if two primitives are equal (not array or object)assertObjectsEqual(actual, expected)
: assert if two objects are equalcountLetters(stringInput)
: count the existance of each letter in a string passedcountOnly(allItems, itemsToCount)
: count the number of times the object key exists in an arrayeqArrays(actual, expected)
: compares two arrayseqObjects(object1, object2)
: compares two objectsfindKey(objectInput, callbackFunction)
: find the key of an object from the callback function passedfindKeyByValue(objectInput, searchKey)
: find the key of an object from the key-value passedflatten(array)
: creates a single depth array from nested arrayshead(array)
: get the first element of an arrayindex
: an object of all functions of lotideletterPositions(sentence)
: list the index of each letter in a stringmap(array, callback)
: returns a new array of transformned by the callback functionmiddle(array)
: get the middle element of an arraytail(arrayInput)
: returns a new array without the first element of the original arraytakeUntil(array, callback)
: returns a slice of the array with elements taken from the beginning depending on callback functionwithout(source, itemsToRemove)
: returns a new array of the original array without the array element specified