1.0.1 • Published 2 years ago
@svng/lotide v1.0.1
Lotide
A mini clone of the Lodash library.
Description
A JavaScript utility library with various helpful functions.
Author
{ "name": "Steven Ngov", "email": "gl.steven.ngov@gmail.com" }
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 @svng/lotide
Require it:
const _ = require('@svng/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertEqual
: compares two values and prints out a message telling us if they do or notassertArraysEqual
: prints out a message telling us if two arrays are identical or notassertObjectsEqual
: prints out a message telling us if two objects are identical or noteqArrays
: compares whether two arrays are identicaleqObjects
: compares whether two objects are identicalcountOnly
: takes in a collection of items and return counts for a specific subset of those itemscountLetters
: takes in a sentence (as a string) and then return a count of each of the letters in that sentencefindKeyByValue
: searches for a key on an object where its value matches a given valuefindKey
: finds key in an object using a callback functionflatten
: given an array with other arrays inside, it flattens it into a single-level arraymap
: returns a new array based on the results of the callback functionhead
: returns the first element in an arraymiddle
: returns the middle element in an arraytail
: returns everything except the first element in an arraytakeUntil
: returns a slice of an array with elements taken from the beginningwithout
: returns a subset of a given array, removing unwanted elements