1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual = function (a1, a2): Checks if two arrays are equal
  • assertEqual = function (actual, expected): Assertion function you can use to test the actual vs expected output
  • eqObjects = function (object1, object2): Verifies if two objects are equal
  • assertObjectsEqual = function (actual, expected): Assertion for eqObjects
  • countLetters = function (string): Counts the number of times a leter appears in a string
  • countOnly = function (allItems, itemsToCount): Sorts through an object and only counts the number of times a value appears. Will return false if the value is not in the object.
  • findKey = function (object, callback): Returns the key if given the value
  • findKeyByValue = function (object, value): finds the key if given the value
  • head(array): returns the first value in an array.
  • letterPositions = function (sentence): returns each index of a letter in a string.
  • map = function (array, callback): The map function will return a new array based on the results of the callback function.
  • middle = function (array): Will return the middle value(s) of an array.
  • tail = function (array): Returns the entire array except the first value.
  • takeUntil = function (array, callback): Will return the array up until a given value.
  • without = function (sourceArray, itemsToRemove): Removes items from an array.