1.0.0 • Published 1 year ago

@kshilina/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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 @kshilina/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • eqArrays : takes in two arrays and returns a boolean value indicating whether they are equal. click here for example
  • assertEqual : compares two values for equality and returns a message indicating whether the assertion passed or failed. click here for example
  • assertArraysEqual : compares two arrays for equality and returns a boolean value. click here for example
  • assertObjectsEqual : compares two objects for equality and returns a message indicating whether the assertion passed or failed. click here for example
  • countLetters : takes in a string and returns an object containing a count of each letter in the string (excluding spaces). click here for 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. click here for example
  • eqObjects : takes in two objects and returns a boolean value indicating whether they are equal. click here for example
  • findKey : takes in an object and a callback function, and returns the first key for which the callback function returns a truthy value. click here for example
  • findKeyByValue : takes in an object and a value, and returns the first key in the object that has the specified value. click here for example
  • flatten : takes in an array and returns a new flattened array (an array with all subarrays flattened into a single level). click here for example
  • head : takes in an array and returns the first element. click here for example
  • letterPositions : takes in a string and returns an object that contains arrays of the positions of each letter in the string. click here for example
  • map : takes in an array and a callback function, and returns a new array with each element transformed by the callback function. click here for example
  • middle : takes in an array and returns the middle element(s) of the array. click here for example
  • tail : takes in an array and returns a new array with all elements except for the first element of the input array. click here for 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. click here for example
  • without : filters elements from the source array and returns a new array that excludes any elements that are also in the itemsToRemove array. click here for example
1.0.0

1 year ago