1.0.1 • Published 4 years ago
@jbawtinheimer/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 @username/lotide
Require it:
const _ = require('@username/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
_.assertArraysEqual()
: basic assertion function for arrays_.assertEqual()
: basic assertion function for primitive data types_.assertObjectEquals()
: basic assertion function for objects_.countLetters()
: method for counting occurences of characters in strings_.countOnly()
: method for count items in objects based on given criteria_.eqArrays()
: method that returns true or false based on whether arrays are equal_.eqObjects()
: method that returns true or false base on whether objects are equal_.findKey()
: method with a callback function for finding a key in an object_.findKeyByValue()
: method for finding a key by its value pair_.flatten()
: a method to flatten out nested arrays into a single top level array_.head()
: returns the first item in an array_.letterPositions()
: returns an object that displays each index a number is at in an array_.map()
: similar to the built in map method in js_.middle()
: returns the middle item/items of an array depending whether the length is odd or even_.tail()
: returns all the elements in an array trailing the item at index 0_.takeUntil()
: returns items in an array until a condition is met_.without()
: takes in two arrays, one is the source array and the other is items to be removed from the source array