1.0.0 • Published 3 years ago

@rjt-sharma/lotide v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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 @rjt-sharma/lotide

Require it:

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

Call it:

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

Documentation

The following functions are currently implemented:

  • assertArraysEqual(arr1, arr2): checks if the provided arrays are equal
  • assertEqual(actual, expected): checks if the provided actual and expected value are equal or not
  • assertObjectEqual(object1, object2): checks if the provided objects are equal or not
  • countLetters(string): returns the numbers of characters for a provided string (excluding spaces)
  • countOnly(allItems, itemToCount): counts only the items mentioned in allItems which are mentioned in itemsToCount
  • eqArrays(arr1, arr2): checks the equality of two arrays
  • eqObjects(object1, object2): checks the equality of two objects
  • findKey(object1, object2): finds key in object1 based on condition provided in object2
  • findKeyByValue(object, value): finds key in object based on value provided
  • head(array): returns the head of an array
  • index(): contains all the functions of this library
  • letterPositions(string): returns an object with index positions of all charcters in the provided string
  • map(array,callback): returns an array after performing a speicfied operation on every element of array
  • middle(array): returns middle element of an array (if odd than single element if even than 2 middle values)
  • tail(array): returns the tail of the provided array
  • takeUntil(array, callback): returns the portion of provided array until the callback is true
  • without(source, itemsToRemove): returns an array with items which are present in source but not in itemsToRemove