1.0.0 • Published 3 years ago
@senay.hailu/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 @senay.hailu/lotide
Require it:
const _ = require('@senay.hailu/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head(...)
: returns the first item of an arraymiddle(...)
: returns the middle item of an arraytail(...)
: return an array without the first itemassertArraysEqual(...)
: equality assertion tester for two arraysassertEqual(...)
: equality assertion for two valuesassertObjectsEqual(...)
: equality assertion for two objectscountLetters(...)
: returns an object with the counts of each letter in a stringcountOnly(...)
: returns an object with items to count given an array of values and an array to count fromeqArrays(...)
: returns true or false to an equality test of two arrayseqObjects(...)
: returns true or false to an equaltiy test of two objectsfindKeyByValue(...)
: a function to find a key of an object by its valuefindKeys(...)
: Given an object and a callback function, find the key paired to the return of the callback functionflatten(...)
: Given an array with nested arrays, it flattens the values into one array.letterPositions(...)
: Returns an object with the frist occurence of each letter in a stringmap(...)
: Given an array of values and a callback function, maps the output of callback function to elements of the arraytakeUntil(...)
: Given an array and a callback function, returns an array until a certain value returned by the callback function is reached.without(...)
: Given 2 arrays, it will remove the elements of the second array from the first array and return the updated array.
1.0.0
3 years ago