1.0.0 • Published 3 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertEqual(actual, expected): comapres if two values are equal and returns a message informing the user if the result was true of false.

  • assertArraysEqual(actual, expected): comapres if the content of two arrays are equal and returns a message informing the user if the result was true of false.

  • assertObjectsEqual(actual, expected): comapres if the content of two objects are equal and returns a message informing the user if the result was true of false.

  • countLetters (sentence): takes in a string as the input and returns an object of how many times each of the letter in the string is present.

  • countOnly(arr, obj): a function that matches an input array with the input object and counts it

  • eqArrays(someArray, anotherArray): function thatcomapres if the content of two arrays are equal and returns either a true of false

  • eqObjects(someObject, anotheObject): function thatcomapres if the content of two objects are equal and returns either a true of false

  • findKey(obj, callback): a function that find an object key and returns it.

  • findKeyByValue(object, objectValue): function that has two input parameters, an object and a string. The functiion returns the key of the object by using the input object and value to find said key

  • head(someArray): function that duplicates an input array and returns only the first elemnent of said array

  • letterPositions(sentence): a function that accepts string as an input and prints out the indices of a given string.

  • map(array, callback): an array of strings that prints out each of the first element in the string and returns it in new array initialized in the function

  • middle(someArray): a function that returns the middle element of an array. Note: there are some conditions on how the middle array is calacuated.

  • tail(someArray): a function that duplictaes the input array provided to us and delete the first elemenent of the duplicate array. It returns the content of the duplicate array back to us.

  • takeUntil(data, callback): a function that takes in two argument an array and callback, creates a new array to store the content if the condition is not meant. If the condition is met, stop the execution of the looping then the array should stop and return the content of the array that has been passed.

  • without(source, itemsToRemove): this function takes a source array, duplicates it and removes the element provided in out itemsToRemove array, returning the altered duplicate array back.