1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(array1, array2): asserts when two arrays are identical
  • assertEqual(actual, expected): asserts when two values are identical
  • assertObjectsEqual(actual, expected): asserts when two objects are identical
  • countOnly(allItems, itemsToCount): checks to see if item in array should be counted
  • eqArrays(array1, array2): checks to see if two arrays are equal
  • eqObjects(object1, object2): checks to see if two objects are equal
  • findKey(object, callback): takes in object, and callback condition. if object contains callback condition, return key
  • findKeyByValue(object, value): takes in an object and a key, loops through object looking for the key
  • head(array): takes in array, returns first value in the array
  • letterPositions(sentence): takes in a string, returns object with letter positions
  • map(array, callback): takes in array and callback function, returns array after modification of callback function
  • middle(array): takes in array, counts array length for even or odd and then returns middle value or the averaged value of the middle 2
  • tail(array): takes in array, removes array0 and returns the rest
  • takeUntil(array, callback): takes in array and callback function, return array contents until callback function's requirements are satsified
  • without(source, itemRemove): takes in 2 arrays, returns a new array without the items in rmvArray