1.0.1 • Published 4 years ago
@paulchen647/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 @chenpoyi/lotide
Require it:
const _ = require('@chenpoyi/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual()
: determines if two arrays are equal and outputs appropriate messagesassertEqual
: determines if two primitives are equal and outputs appropriate messagesassertObjectsEqual())
: determines if two objects are equal and outputs appropriate messagescountLetters()
: returns the number of appearances if each letter in a stringcountOnly()
: returns the number of occurences of a specific item in an arrayeqArrays()
: returns whether 2 arrays is equaleqObjects()
: returns whether 2 objects are equalfindKey()
: finds key holding a given valuefindKeyByValue()
: finds key holding a given valueflatten()
: returns a flattened arrayhead()
: returns first element of an arrayletterPositions()
: returns positions of given letter in an arraymap()
: maps an array with given callback functionmiddle()
: returns the middle element(s) of an arraytail()
: returns subarray holding the tail values of the arraytakeUntil()
: cuts off array at the element satisfying the callback functionwithout()
: returns array without the given element