1.0.0 • Published 4 years ago
lotide-library v1.0.0
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 @emikeke/lotide
Require it:
const _ = require('@emikeke/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
head
: returns first element in an arraytail
: returns everything except first element in an arraymiddle
: returns middle-most element(s) in an arrayassertArraysEqual
: returns T/F after comparing actual with expected value (supports non primitive types)assertEqual
: compares actual with expected value (doesn't support objects & array)assertObjectsEqual
: returns T/F after comparing actual with expected value (supports objects)countLetters
: returns a count of each of the letters in a stringcountOnly
: returns counts for a specific subset of itemseqArrays
: compares actual with expected value (supports arrays)eqObjects
: takes 2 objects, returns T/F based on a perfect matchfindKey
: returns the first key for which the callback returns a truthy value if no key ifindKeyByValue
: returns the first key with contains the given valueletterPositions
: return all the indicies in the string where each character is foundmap
: returns a new array based on the results of the callback functiontakeUntil
: returns a slice of the array with elements taken from the beginning and keeps going until the callback/predicate returns a truthy valuewithout
: returns a subset of a given array, removing unwanted elements
1.0.0
4 years ago