1.0.0 • Published 4 years ago

@michellelindseyv/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

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 @michellelindseyv/lotide

Require it:

const _ = require('@michellelindseyv/lotide');

Call it:

const results = _.tail([1, 2, 3]) // => [2, 3]

Documentation

The following functions are currently implemented:

  • assertArraysEqual(...): evaluate if the array returned is equal to expected return value
  • assertEquals(...): evaluates if two arrays are equal
  • assertObjectsEqual(...): evaluates if the key object pairs of two different objects are equal
  • countLetters(...): takes in a sentence (as a string) and then returns a count of each of the letters in that sentence
  • countOnly(...): takes in a group of items and returns counts for a defined subset of those items
  • eqArrays(...): takes in two arrays and returns true or false based on a perfect match
  • eqObjects(...): takes in two objects and return true or false based on a perfect match
  • findKey(...): takes an object and a callback and returns the first key for which the callback returns a truthy value.
  • findKeyByValue(...): takes an object and value. Returns the first key which contains the given value. If no key with that given value is found, it returns undefined.
  • head(...): retrieves the first element from an array
  • letterPositions(...): returns all the indices in the string where each character is found.
  • map(...): returns a new array based on the results of the callback function
  • middle(...): returns middle two values if array length is even, single middle value if array is uneven and and empty array if there are two values or less
  • tail(...): removes the first index of an array and returns the remaining
  • takeUntil(...): returns values in the array until a specified condition is met
  • without(...):
1.0.0

4 years ago