1.0.2 • Published 2 years ago

@seangray-dev/lotide v1.0.2

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 @seangray-dev/lotide

Require it:

const _ = require('@seangray-dev/lotide');

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual: compares two arrays for equality and returns a boolean value while also logging a message to the console. See Example
  • assertEqual: compares two values for equality and returns a message indicating whether the assertion passed or failed. See Example
  • assertObjectsEqual: compares two objects for equality and returns a message indicating whether the assertion passed or failed. See Example
  • countLetters: takes in a string and returns an object containing a count of each letter in the string (excluding spaces). See Example
  • countOnly: takes in an array of items and an object containing a set of items to count, and returns an object with counts of the items in the original array that are specified in the input object. See Example
  • eqArrays: takes in two arrays and returns a boolean value indicating whether they are equal. See Example
  • eqObjects: takes in two objects and returns a boolean value indicating whether they are equal. See Example
  • findKey: takes in an object and a callback function, and returns the first key for which the callback function returns a truthy value. See Example
  • findKeyByValue: takes in an object and a value, and returns the first key in the object that has the specified value. See Example
  • flatten: takes in an array and returns a new flattened array (an array with all subarrays flattened into a single level). See Example
  • head: takes in an array and returns the first element See Example
  • letterPositions: takes in a string and returns an object that contains arrays of the positions of each letter in the string. See Example
  • map: takes in an array and a callback function, and returns a new array with each element transformed by the callback function. See Example
  • middle: takes in an array and returns the middle element(s) of the array. See Example
  • tail: takes in an array and returns a new array with all elements except for the first element of the input array. See Example
  • takeUntil: takes in an array and a callback function, and returns a new array that includes all elements of the input array up until the point where the callback function returns a truthy value. See Example
  • without: filters elements from the source array and returns a new array that excludes any elements that are also in the itemsToRemove array. See Example
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago