1.0.0 • Published 4 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • head: Return the head or the first element of an array
  • tail: Return the tail or all elements of the array but the head (first element)
  • middle: Return the middle 2 array elements of an EVEN array or the middle values of an ODD array
  • `assertArraysEqual: Check if two arrays have the EXACT same values
  • `assertEqual: Check if the actual result equals the expected result
  • asserObjectsEqual: Checks 2 objects to see if the key and value pairs match
  • countLetters: Counts the EACH letter of of a sentence and returns the count as an object
  • countOnly: Returns an object containing counts of a given array and object
  • `findKey: Return the first key for which a callback returns a truthy value
  • findKeyByValue: Return a match of a given key within an object
  • map: Returns a new array based on the results of a callback funtion
  • letterPositions: Returns the index of the string letter
  • without: Returns an new array from a provided source and itemsToRemove array
  • takeUntil: Returns a slice of the array with elements from the beginning until a callback/predicate returns a truthy value
  • eqAarray: Check if 2 arrays return true or false based on a perfect match
  • eqObjects: Check if 2 objects return true or false bassed on perfect match
  • takeUntil: Returns a slice of the array with elements from the beginning until a callback/predicate returns a truthy value