1.0.1 • Published 5 years ago
@kelelenceu/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 @kelelenceu/lotide
Require it:
const _ = require('@kelelenceu/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head([...])
: returns first element of an arraytail([...])
: returns all elements except the first element of an arraymiddle([...])
: returns the middle element(s) of an array as an arraycountLetters(string)
: returns number of occurences of each letter in a string as an objectcountOnly(allItems, itemsToCount)
: returns the number of occurences of the items in itemsToCount in allItemseqArrays(a, b)
: returns true if a and b are identical arrayseqObjects(a, b)
: returns true if a and b are identical objectsfindKey(obj, predicate)
: returns the key in obj that satisfies predicatefindKeyByValue(obj, value)
: returns the key in obj with the specified valueflatten([...])
: returns a flattened version of an arrayletterPositions(string)
: returns the positions in which each character of a string occured as an objectmap([...], mapping)
: returns a new array populated with the results of calling a provided function on every element in the calling arraytakeUntil([...], callback)
: returns a new array populated with elements of the calling array until the callback returns true for the elementwithout([...], unwanted)
: returns a new array with all the elements of the calling array except the unwanted element