1.0.0 • Published 2 years ago
@kbcastro/lotide 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 @kbcastro/lotide
Require it:
const _ = require('@kbcastro/lotide');
Call it:
const results = _.tail([1, 2, 3]) // => [2, 3]
Documentation
The following functions are currently implemented:
assertArraysEqual
: function that asserts if two arrays are equalsassertEqual
: function that asserts if two primitive values are equalsassertObjectsEqual
: function that asserts if two objects are equalscountLetters
: function that returns the number of occurrences of each letter in a stringcountOnly
: function that returns the number of occurrences of items in an objecteqArrays
: function that compares two arrayseqObjects
: function that compares two objectsfindKey
: function that returns the key given an object and callback function; returns a truthy value. Will return undefined if no key is foundfindKeyByValue
: function that returns the first key containing the value of the inputted object and value, will return undefined if no key with the given value is foundhead
: function that returns the first element of an arrayindex
: list of all the functions in an objectletterPositions
: function that returns all the indices in the string where each character is foundmap
: function that takes an array and callback that will return a modified array with the callback function appliedmiddle
: function that returns the middle element(s) of an arraytail
: function that returns a new array with the first index element removed from the original arraytakeUntil
: function that returns a slice of the array with elements taken from the beginningwithout
: function that removes elements from a given array
1.0.0
2 years ago