1.0.1 • Published 1 year ago
@anakuz/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 @anakuz/lotide
Require it:
const _ = require('@anakuz/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: function to determine if two arrays are equalassertEqual
: function to determine if two inputs are equalassertObjectsEqual
: function to determine if two objects are equalcountLetters
: function that takes in a string of letters and returns an object of letter keys and the number of times they occur as valuescountOnly
: function that takes in an array of strings and returns how many times an item occurs in that arrayeqArrays
: function that compares two arrayseqObjects
: function that compares two objectsfindKey
: function that scans an object and returns the first key for which the callback returns a truthy valuefindKeyByValue
: function that scans an object and returns the key of the input valueflatten
: function that takes a nested array and returns a single array (un-nests inner arrays)head
: function takes in array and returns only the first value of an arrayindex
: list of all the functions in lotideletterPositions
: function to turn a string into an object that shows each letter and the index at which it occursmap
: takes in array and callback function to return new, transformed arraymiddle
: function that returns the middle element of an arraytail
: function returns a new array with everything but the first value of input arraytakeUntil
: unction that takes the first portion of an input array to a point specified by an input callbackwithout
: function takes in an array and an item to be removed from that array