1.0.0 • Published 2 years ago

@kruciall/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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 @kruciall/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual: Compares two arrays to see if they are equal - returns true or false
  • assertEqual: Compares two primitive values - returns true if they are equal
  • assertObjectsEqual: Compares two objects - returns true if they are equal
  • countLetters: Given a string of letters - retuurns the number of occurences
  • countOnly: Given an object - returns the number of occurences
  • eqArrays: Compares two arrays and returns true if they are equal
  • eqObjects: Comapres two objects - returns true if they are equal
  • findKey: Given an object and callback function - returns first key in which callback function returns a truthy value
  • findKeyByValue: Given an object and callback function - identifies the keys value
  • head: Retrieves the first element from an array
  • letterPositions: Given a string - returns all the indices in the string for each character
  • map: Given an array and callback - returns the modified array with callback function applied
  • middle: Given an array - returns the middle element(s)
  • tail: Given an array - returns a new array with the first index element removed
  • takeUntil: Given an array and callback - returns all matching elements until a different element
  • without: Given an array and value of an array - returns a new array with the elements removed