1.0.0 • Published 2 years ago

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

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • function1(assertEqual): function, that compare the two values it takes in and print out a message telling us if they match or not.
  • function2(head): function that retrieves the first element from the array.
  • function3(eqArrays): function that compares two arrays and checks if it's a perfect match.
  • function1(assertArraysEqual): function for asserting that two arrays are equal.
  • function2(without): returns a subset of a given array, removing unwanted elements.
  • function3(middle): take in an array and return the middle-most element(s) of the given array.
  • function1(countOnly): function takes in a collection of items and returns counts for a specific subset of those items.
  • function2(findKeyByValue): function which scans the object and returns the first key which contains the given value.
  • function3(eqObjects): function takes in two objects and returns true or false, based on a perfect match.
  • function1(assertObjectsEqual): function which takes in two objects and compares them.
  • function2(map): function returns a new array based on the results of the callback function.
  • function3(takeUntil): function returns a slice of the array with elements taken from the beginning.
  • function3(findKey): function takes in an object and a callback. It scans the object and return the first key for which the callback returns a truthy value. If no key is found, then it returns undefined.