1.0.0 • Published 2 years ago

@josh-sparkes-21/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 @josh-sparkes-21/lotide

Require it:

const _ = require('@josh-sparkes-21/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArrayEqual: console.logs whether two arrays are Equal
  • assertEqual: console.logs whether two values are equal
  • assertObjectsEqual: console.logs whether two objects are equal
  • countLetters: Counts how many times a letter is occuring in a string
  • countOnly: Counts how many times a value occurs in an array given a specific value
  • eqArrays: Determines whether two array are equal
  • eqObjects: Determines whether two objects are equal
  • findKey: Given an object and a value, locates the key in which the value is paired to
  • head: Gives the first element of an array
  • letterPositions: Given a string, returns an array of indices for each character in string
  • map: Accepts an array and callback function
  • middle: Returns the middle of an array. If array length is even, returns 2 middle indices. If array length is odd, returns middle indice
  • tail: Returns every element after the first element
  • takeUntil: Will keep collecting items from a provided array until the callback provided returns a truthy value
  • without: Given an array, and an array of values that need to be removed, returns a new array in which specified values are removed