1.0.3 • Published 2 years ago

@noahpalin/lotide v1.0.3

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(arr1, arr2): Checks if two arrays are identical to eachother using assertion.
  • assertEquals(actual, expected): Checks if two pieces of data are equal using assertion. The function will then provided a message telling the user if the test passed or failed.
  • assertObjectsEqual(object1, object2): Checks if two objects have identical keys with identical values.
  • countLetters(str): Counts how many of each letter there are in a string, then returns that answer in an object.
  • countOnly(allItems, itemsToCount): Takes in an array of strings and counts how many of a specified string is in the array.
  • eqArrays(arr1, arr2): Checks if two arrays are equal to eachother and returns true if they are, and false if they are not.
  • eqObjects(object1, object2): Checks if two objects have identical keys with matching identical values.
  • findKey(obj, callback): Loops through an object and returns the first key whoes vallue passes the callback function.
  • findKeyByValue(obj, target): Loops through an object are returns the first key that matches the target value.
  • flatten(arr): Takes in a 2D array and converts it to a 1D array.
  • head(arr): This small function returns to the user the head (first element) in an array.
  • letterPosition(sentence): Takes in a string and returns all the indices of a specified character.
  • map(array, callback): Applies a function (the callback function) to each element inside an array of strings.
  • middle(arr): Finds the middle element(s) of an array of numbers.
  • tail(arr): This small function returns to the user the tail (every element other than the head) in an array.
  • takeUntil(array, callback): Returns a new array from a given array containing every each element from the original until an element causes the callback to return true.
  • without(source, itemsToRemove): Takes in an array and removes every element that matches an element in the itemsToRemove array, the returns the new altered array.
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago