1.0.0 • Published 2 years ago

@rajulramani/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
-
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 @rajulramani/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(array1, array2): arrertion for 2 equal arrays
  • assertEqual (actual, expected): arrertion for 2 equal numbers
  • assertObjectsEqual(actual, expected): assertion for 2 equal objects
  • acountOnly (allItems, itemsToCount) : Counts the number of item in a list
  • eqArrays (array1, array2) : checks for 2 equal arrays
  • eqObjects (object1, object2) : checks for 2 equal objects
  • findKey(object, callback) : returns the key of given object using callback function
  • findKeyByValue (givenObject, givenValue) : finds key of the object from given value
  • head(array) : returns first element of any array
  • map (array, callback) : returns an array of mapped items from the callback function
  • middle (array) : returns middle element from an odd array and returns middle 2 elements from an even array
  • takeUntil (array, callback) : returns a sliced array of elements based on callback function
  • without (array1, array2) : returns an array after removing array 2 elements from array1