1.0.0 • Published 3 years ago

@r_darke1!/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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 @r_darke1!/lotide

Require it:

const _ = require('@r_darke1!/lotide');

Documentation

The following functions are currently implemented:

  • head(): Will find the head value within an array.

  • middle(arr): Will provide the middle value of an odd sized array or the two middle values of an even sized array.

  • assertArraysEqual(arrayA, arrayB): Will assert if arrays are shown to be equal.

  • assertEqual(actual, expected): Will assert if actual equals expected value.

  • assertObjectsEqual(actual, expected),: Will assert if objects are shown to be equal.

  • countLetters(string): Will loop through the given string and confirm how many times each letter is shown within the string via an object count.

  • countOnly(allItems, itemsToCount): Will provide a count of truthy values only.

  • eqArrays(arrayA, arrayB): Will confirm if two arrays are equal.

  • eqObjects(object1, object2): Will confirm if two objects are equal.

  • findKey(obj, cb): Will provide a list of each key within a given object.

  • findKeyByValue(obj, value): Takes in an object and a value. It should scan the object and return the first key which contains the given value. If no key with that given value is found, then it should return undefined.

  • letterPositions(sentence): Will keep a count on how many times each letter is shown within a string.

  • takeUntill(array, callback): Will return a "slice of the array with elements taken from the beginning." It should keep going until the callback/predicate returns a truthy value.

  • without(source, itemsToRemove): Will return an array without the selected itemsToRemove.